A java code to find the gcd of two numbers | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

A java code to find the gcd of two numbers

to find the greatest common divisor of the numbers. and I want it to implement with Java.

18th Jan 2017, 6:02 PM
WONDE-TOM
WONDE-TOM - avatar
2 Answers
+ 1
your problem is more math is not a programming problem
18th Jan 2017, 6:30 PM
alireza shokri
alireza shokri - avatar
+ 1
int gct(int a, int b){ while(b != 0){ int r = a%b; a = b; b = r; } return a; }
18th Jan 2017, 6:36 PM
Robobrine
Robobrine - avatar