Find Remainder Problem Code: FLOW002 (CodeChef)

Write a program to find the remainder when an integer A is divided by an integer B.

Input

The first line contains an integer T, the total number of test cases. Then T lines follow, each line contains two Integers A and B.

Output

For each test case, find the remainder when A is divided by B, and display it in a new line.

Constraints

  •  T  1000
  •  A,B  10000

Example

Input
3 
1 2
100 200
40 15

Output
1
100
10
Solution
t=int(input())
for i in range (t):
    a,b = map(int,input().split())
    ans=(a%b)
    print(ans , end = " ")

Comments

Popular posts from this blog

Chef and Remissness Problem Code: REMISS (CodeChef)

Sort in specific order (GFG)

Reverse words in a given string (GFG)