#include<stdio.h>
#include <conio.h>
int gcd ( int a, int b )
{
int r;
if ( ( r = a%b ) == 0 )
return b;
else
return gcd ( b , r );
}
void main(void){
int p,q;
printf("\n Enter two numbers: ");
scanf("%d %d",&p,&q);
printf("\n The gcd is %d ",gcd(p,q));
getch( );
}
#include <conio.h>
int gcd ( int a, int b )
{
int r;
if ( ( r = a%b ) == 0 )
return b;
else
return gcd ( b , r );
}
void main(void){
int p,q;
printf("\n Enter two numbers: ");
scanf("%d %d",&p,&q);
printf("\n The gcd is %d ",gcd(p,q));
getch( );
}
No comments:
Post a Comment