In this program, you will take two numbers from the user and finding the GCD of two numbers. GCD is also called HCF (Highest Common Factor).

For example, the GCD of two numbers, 8 and 12 are 4 because factors for 8 are 1,2,**4**,8 and factor for 12 are 1,2,3,**4**,6,12, largest command factor is 4. hence GCD of 8 and 12 is 4.

```
#include<stdio.h>
int main()
{
int a,b,i,gcd;
printf("enter two number:");
scanf("%d%d",&a,&b);
for(i=0;a!=b;i++)
{
if(a>b)
a=a-b;
else
b=b-a;
}
gcd=a;
printf("\n gcd of two number is:%d",gcd);
return 0;
}
```

enter two number:8 12 gcd of two number is:4