Advertisement
DanikYakush

Task24

Jul 6th, 2022
905
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.31 KB | None | 0 0
  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
Add Comment
Please, Sign In to add comment
Advertisement