chillurbrain

Task2Lab5_1

Dec 8th, 2015
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.31 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. class Task2_5_1 {
  4.     public static void main(String[] args) {
  5.         Scanner sc = new Scanner(System.in);
  6.         int m = sc.nextInt(), n = sc.nextInt();
  7.         System.out.println(GCD(m, n));
  8.     }
  9.  
  10.     public static int GCD(int a, int b) {
  11.         if (b == 0)
  12.             return a;
  13.         else return GCD(b, a % b);
  14.     }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment