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