## C program find the GCD of the 2 numbers using functions

*in*3rd Semester CS

/*WAP to find the GCD of the 2 numbers using functions*/ #include<stdio.h> void main() { int gcd(int,int); int m,n; clrscr(); printf("Input 2 Numbers-\n"); scanf("%d%d",&m,&n); printf("GCD of %d and %d is %d",m,n,gcd(m,n)); getch(); } int gcd(int x, int y) { while(x!=y) { if(x>y) x=x-y; else if(y>x) y=y-x; } return(x); }

## Output

Input 2 Numbers- 12 24 GCD of 12 and 24 is 12