/* Finding the GCD or HCF problem in C */
main( )
{
int x, y, z;
scanf("%d", &x);
scanf("%d", &y);
printf("gcd of %d and %d is \n", x, y);
do
{
z = x % y;
printf( " %d ", z );
x = y;
if (z!=0)
y = z;
}
while ( z! = 0 );
printf( " \n%d\n", y);
}
(i) if you input 164 &
24
output is
gcd of 164 & 24 is
20 4 0
4 ( HCF )
(ii) (i) if you input 184 &
48
output is
gcd of 184 & 48 is
40 8 0
8 ( HCF )
22/06/2001