Tasks and Requirements
/**copyright (c) 2016,CSDN College *all rights reserved.* file name: lzz.c* Creator: Linzeze * Completion Date: May 8, 2016 * version number: v1.0* Problem Description: Ask greatest common divisor (1) to enter two numbers and find out its greatest common divisor. Please write out the function of greatest common divisor (2) on the basis of the above program, increase the function GCDs function declaration and definition, to achieve the function of 4 number greatest common DIVISOR * Program input * Program output: */#include <stdio.h>int gcd (int x,int y)// Defines a function that is used to greatest common divisor a number of two, and the function evaluates the value regardless of the output. The output is completed by main { int r=x%y; while (r!=0) { x=y; Y=r; r=x%y; } return y;} int main () { int a,b,g; scanf ("%d%d", &a, &b); G=GCD (A, b); printf ("Greatest common divisor is:%d\n", g); return 0;}
Run results
Improved Item 3 (1)--seeking greatest common divisor