This program considers x and y as input.If both the numbers x
and y are 0 then GCD is 0.If either of the two number is 0 then
the next non-zero number is GCD.If the fist two conditions are not
satisfied then the smaller number is subtracted from the larger
numner.This process continous until the number are equivalent to
each other.When both the numbers are equivalent then x is **GCD
of two numbers**.

#include < stdio.h > #include < conio.h > void main() { int x,y; clrscr(); printf("\nEnter two numbers :"); scanf("%d %d",&x,&y); if(x==0 && y==0) printf("\n No GCD"); else if(x==0 && y!=0) printf("GCD is %d",y); else if(x!=0 && y==0) printf("GCD is %d",x); else { while(x!=y) { if(x>y) x=x-y; else if(x < y) y=y-x; } printf("\n GCD is %d",x); } }