GCD of two numbers
Submissions: 9349   Accuracy:

53.71%

  Difficulty: School   Marks: 0
*School Problem's Submission isn't counted in score!

Given two numbers A and B. The task is to find the GCD of those 2 numbers.

Input:
The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. Each test case contains two space separated integers A and B.

Output:
For each testcase, in a new line, print the GCD of the two numbers.

Constraints:
1 <= T <= 100
1 <= A, B <= 103

Example:
Input:

98 56
48 18

Output:
14
6

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Ayush Govil
Author: Ayush Govil 1


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.


to report an issue on this page.