Advertisement
Guest User

Untitled

a guest
Aug 24th, 2016
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. class Main {
  4. public static void main(String[] args) {
  5. Scanner sc = new Scanner(System.in);
  6. int x = sc.nextInt();
  7. int y = sc.nextInt();
  8.  
  9. if(x < y){
  10. int tmp = x;
  11. x = y;
  12. y = tmp;
  13. }
  14.  
  15. while(x % y != 0){
  16. int tmp = x % y;
  17. x = y;
  18. y = tmp;
  19. }
  20. System.out.println(y);
  21.  
  22. }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement