7 lines
123 B
Text
7 lines
123 B
Text
public int gcd_iterative(int a, b){
|
|
if(a == 0) return b;
|
|
while(b != 0){
|
|
if(a > b) a -= b;
|
|
else b -= a;}
|
|
return a;
|
|
}
|