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