gcd 3d 1

Solutions on MaxInterview for gcd 3d 1 by the best coders in the world

showing results for - "gcd 3d 1"
Agustín
18 Oct 2019
1import java.util.Scanner;
2public class   Euclid {
3    static public void main(String[] argh){
4        System.out.print("Enter two numbers: ");
5        Scanner input = new Scanner(System.in);
6        int a = input.nextInt();
7        int b = input.nextInt();
8        int TEMP = 0 ;
9        int GCD = 0;
10        int max = a>b?a:b;
11        int min = a<b?a:b;
12        while(min!=0){
13            TEMP=(max%min);
14            GCD = min ;
15            min = TEMP;
16        }
17        System.out.print("("+GCD+")");
18    }
19}
20
21