Topic 1056: Greatest Common divisor
time limit:1 seconds
Memory limit:32 MB
Special question: No
submitted:4771
Resolution:3097
-
Title Description:
-
Enter two positive integers to greatest common divisor.
-
Input:
-
There are several groups of test data, with two positive integers entered per group.
-
Output:
-
For each set of inputs, output its greatest common divisor.
-
Sample input:
-
49 14
-
Sample output:
-
7
-
#include <stdio.h>int x (int a,int b) { if (a%b==0) return B; else return x (b,a%b);} int main (int argc, char *argv[]) { int m,n; freopen ("In.txt", "in", stdin); while (scanf ("%d%d", &m,&n)!=eof) { if (m>n) printf ("%d\n", X (M,n)); else printf ("%d\n", X (N,m)); } return 0;} /************************************************************** problem:1056 user:kirchhoff Language:c result:accepted time:0 ms memory:912 kb*********************************************** *****************/
Nine degrees OJ 1056 greatest common divisor