find gcd iteratively

C
// C program to find HCF of two 
// numbers iteratively. 
#include <stdio.h> 
  
int hcf(int a, int b) 
{ 
    while (a != b) { 
        if (a > b)         
            a = a - b;         
        else        
            b = b - a;         
    } 
    return a; 
} 
int main() 
{ 
    int a = 60, b = 96; 
    printf("%d\n", hcf(a, b));  
    return 0; 
} 

Source

Also in C: