public static void main(String[] args) { int a = 9; int b = 18; int c = 0; while (a % b != 0) { c = a %b; a = b; b = c; } System.out.println(c); }