| 1 | import java.util.Scanner; |
| 2 | |
| 3 | public class GCD { |
| 4 | static int gcd(int x, int y){ |
| 5 | if(y == 0) return x; |
| 6 | return gcd(y, x % y); |
| 7 | } |
| 8 | |
| 9 | static int iGCD(int x, int y){ |
| 10 | while (x % y != 0){ |
| 11 | int rem = x % y; |
| 12 | x = y; |
| 13 | y = rem; |
| 14 | } |
| 15 | return y; |
| 16 | } |
| 17 | |
| 18 | public static void main(String[] args) { |
| 19 | Scanner sc = new Scanner(System.in); |
| 20 | int x = sc.nextInt(); |
| 21 | int y = sc.nextInt(); |
| 22 | System.out.println(iGCD(x, y)); |
| 23 | System.out.println(gcd(x, y)); |
| 24 | } |
| 25 | } |
nothing calls this directly
no outgoing calls
no test coverage detected