Find Remainder CodeChef Solution

Hello coders, today we will be solving Find Remainder CodeChef Solution whose Problem code is FLOW002. Write a program to find the remainder when an i

Hello coders, today we will be solving Find Remainder CodeChef Solution whose Problem code is FLOW002.

Find Remainder CodeChef Solution

Problem

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

  • 1 <= T <= 1000
  • 1 <= A, B <= 10000

Example

Input 

3 
1 2
100 200
40 15

Output 

1
100
10

Solution - Find Remainder CodeChef Solution 

Python 3

#Solution Provided by Sloth Coders
N = int(input())
while N > 0:
    a, b = map(int, input().split())
    Remainder = a % b 
    print(Remainder)
    N = N - 1

Disclaimer: The above Problem (Find Remainder) is generated by CodeChef but the Solution is generated by Sloth Coders.

Happy Coding !!

A Sloth Who loves to Code

Also Read:

Sloth Coders is a Learning Platform for Coders, Programmers and Developers to learn from the basics to advance of Coding of different langauges(python, Java, Javascript and many more).

Post a Comment