int GCD(int x, int y) //will find greatest common divisor of three numbers { int r; while(true) //loops while r is not equal to 0 { r= y % x; //finds remainder of y / x and stores it in variable r if(r == 0) //returns value of x if r is equal to 0 return x; else //if r is not eqaul to 0, y gets value of x and x gets value of r y=x; x=r; } }