Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace Problem20
- {
- class Program
- {
- public static void Main(string[] args)
- {
- int t = int.Parse(Console.ReadLine());
- for (int i = 0; i < t; i++)
- {
- string[] tab = Console.ReadLine().Split(' ');
- int a = int.Parse(tab[0]);
- int b = int.Parse(tab[1]);
- int tmp = 0;
- while (a != b)
- {
- tmp = a;
- a -= b;
- if (a < 0)
- {
- b = -a;
- a = tmp;
- }
- }
- Console.WriteLine(a + b);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement