Advertisement
DanikYakush

Task24

Jul 6th, 2022
839
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class Task24 {
  2.     public static int gcd(int a, int b) {
  3.         while (b > 0) {
  4.             a %= b;
  5.             int tmp = a;
  6.             a = b;
  7.             b = tmp;
  8.         }
  9.         return a;
  10.     }
  11.  
  12.     public static int gcd4(int a, int b, int c, int d) {
  13.         return gcd(gcd(gcd(a, b), c), d);
  14.     }
  15. }
Advertisement
RAW Paste Data Copied
Advertisement