GCD of Two Numbers
· unclassifiedUnclassifiedmath
Problem
GCD of Two Numbers
javamay contain transcription errors
import java.util.*;
class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int a = sc.nextInt(), b = sc.nextInt();
while(b != 0){
int temp = b;
b = a % b;
a = temp;
}
System.out.println(a);
}
}