C Programming
Computer Programming

Program in c to Find Greatest Common Diviser (GCD) of two Numbers



Write a Program in c to Find Greatest Common Diviser (GCD) of two Numbers

\* C Program to to Find Greatest Common Diviser (GCD) of two Numbers *\

# include < stdio.h >
int   main( )
{

int   num1, num2, i, gcd  ;
printf(" Enter the first Number : ") ;
scanf("%d ", & num1) ;
printf("\n Enter the second Number : ") ;
scanf("%d ", & num2) ;
i = 1 ;
do
{

if(   num1  % i   == 0   &&  num2   % i   == 0   )
gcd = i ;
i = i + 1 ;

}
while (   i   <=   10 ) ;
printf(" Greatest Comman Multiple of Entred Number is : ") ;
printf("%d ", gcd) ;
return ( 0 ) ;

}

Output of Program :

Output of Program in C to Find Greatest Comman Diviser (GCD) of two Numbers