Find the GCD of two positive integer.
Find the G.C.D of two positive integer.
#include< #include< void main( ) { int a, b; clrscr( ); printf("Enter any two positive integer\n"); scant("%d %d", &a, &b); while (a!=b) { if (a > b) a = a - b; else b = b - a; } printf("The gcd is %d \n", a); } |
---|
0 comments:
Post a Comment