A Way For Learning

Program to find the GCD of two numbers

No comments
/*Program to find the GCD of two numbers*/
public class Prgrm {
public static void main(String[] args) {
int a=33;
int b=22;
int temp;
while(b!=0){
temp=a;
a=b;
b=temp%b;
}


System.out.println("gcd of given numbers is " + a);
}
}

No comments :

Post a Comment