#include <stdio.h>
int main()
{
int a,b,i,min;
printf("Enter Two Positive Integers : ");
scanf("%d%d",&a,&b);
min = (a<b)? a: b;
for (i=min ; i>=1; i--)
{
if (a%i == 0 && b%i == 0)
{
printf("GCD = %d", i);
break;
}
}
return 0;
}
int main()
{
int a,b,i,min;
printf("Enter Two Positive Integers : ");
scanf("%d%d",&a,&b);
min = (a<b)? a: b;
for (i=min ; i>=1; i--)
{
if (a%i == 0 && b%i == 0)
{
printf("GCD = %d", i);
break;
}
}
return 0;
}
Comments
Post a Comment