Advertisement
Guest User

Untitled

a guest
Dec 21st, 2011
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. import java.util.*;
  2.  
  3. public class Solver {
  4.  
  5. public static void main(String[] args) {
  6. Scanner cin = new Scanner(System.in);
  7. int a,b;
  8.  
  9. while(cin.hasNext())
  10. {
  11. a=cin.nextInt();
  12. b=cin.nextInt();
  13. while(a*b!=0)
  14. {
  15. if(a>b)
  16. {
  17. a%=b;
  18. }
  19. else
  20. {
  21. b%=a;
  22. }
  23. };
  24. System.out.println(a+b);
  25. }
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement