Write an iterative GCD with a defensible loop

Write a nonrecursive C program for the greatest common divisor of two integers in 0..30000. Use the repeated-remainder rule gcd(a,b)=gcd(b,a%b) while b is nonzero. Print gcd=G; if both inputs are zero print undefined, meaning this task deliberately leaves gcd(0,0) without a value. For failed/out-of-range input print invalid.

    Show the successive (a,b) pairs for 48 and 18, explain the update order, and justify termination. Handle a zero in either position. The word undefined in the specified output refers to the mathematical convention of this task, not undefined behavior in the C program.

Assume every integer token supplied is representable in int.


