Why we are writing while(dividend/divisor!=0) ?instead of this can we write while(remainder!=0)?? But im getting error in that case!
Condition in while loop
while (divident % divisor != 0) {
int rem = divident % divisor;
divident = divisor;
divisor = rem;
}
if here you’ve replaced the while condition, then the remainder variable is not defined for that condition.We have defined it inside the loop.