fork download
  1. class M{
  2. static int c(int a, int b){
  3. return b > 0
  4. ? c(b, a%b)
  5. : a;
  6. }
  7.  
  8. public static void main(String[] a){
  9. System.out.println(c(0, 2));
  10. System.out.println(c(6, 0));
  11. System.out.println(c(30, 42));
  12. System.out.println(c(15, 14));
  13. System.out.println(c(7, 7));
  14. System.out.println(c(69, 25));
  15. System.out.println(c(21, 12));
  16. System.out.println(c(169, 123));
  17. System.out.println(c(20, 142));
  18. System.out.println(c(101, 202));
  19. }
  20. }
Success #stdin #stdout 0.04s 711168KB
stdin
Standard input is empty
stdout
2
6
6
1
7
1
3
1
2
101