gcd algorithm
function gcd(a, b)
if b = 0
return a
else
return gcd(b, a mod b)
gcd algorithm
function gcd(a, b)
if b = 0
return a
else
return gcd(b, a mod b)
gcd algorithm
function gcd(a, b)
if b = 0
return a
else
return gcd(b, a mod b)
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+")");
}
}
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+")");
}
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us