Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- class Task2_5_1 {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- int m = sc.nextInt(), n = sc.nextInt();
- System.out.println(GCD(m, n));
- }
- public static int GCD(int a, int b) {
- if (b == 0)
- return a;
- else return GCD(b, a % b);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment