Answers for "GCD(29, 288)"

0

gcd = 1

import java.util.Scanner;
public class   Euclid {
    static public void main(String[] argh){
        System.out.print("Enter two numbers: ");
        Scanner input = new Scanner(System.in);
        int a = input.nextInt();
        int b = input.nextInt();
        int TEMP = 0 ;
        int GCD = 0;
        int max = a>b?a:b;
        int min = a<b?a:b;
        while(min!=0){
            TEMP=(max%min);
            GCD = min ;
            min = TEMP;
        }
        System.out.print("("+GCD+")");
    }
}
Posted by: Guest on July-20-2021
0

gcd = 1

import java.util.Scanner;
public class   Euclid {
    static public void main(String[] argh){
        System.out.print("Enter two numbers: ");
        Scanner input = new Scanner(System.in);
        int a = input.nextInt();
        int b = input.nextInt();
        int TEMP = 0 ;
        int GCD = 0;
        int max = a>b?a:b;
        int min = a<b?a:b;
        while(min!=0){
            TEMP=(max%min);
            GCD = min ;
            min = TEMP;
        }
        System.out.print("("+GCD+")");
    }
}
Posted by: Guest on July-20-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language