C examples for Statement:while
Finding the Greatest Common Divisor
#include <stdio.h> int main (void) { int u, v, temp; printf ("Please type in two nonnegative integers.\n"); scanf ("%i%i", &u, &v); while (v != 0) { temp = u % v;// ww w .j a v a2 s.c o m u = v; v = temp; } printf ("Their greatest common divisor is %i\n", u); return 0; }