# CodeChef - Find Remainder

Find Remainder problem from CodeChef.

**Problem**

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

`A`

**.**

`B`

**Input**

The first line contains an integer , the total number of test cases. Then

`T`

**lines follow, each line contains two Integers**

`T`

**and**

`A`

**.**

`B`

**Output**

For each test case, find the remainder when is divided by

`A`

**, and display it in a new line.**

`B`

**Constraints**

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

## Solution in Java:

```
import java.util.*;
class Remainder
{
public static void main(String args[])
{
Scanner s = new Scanner(System.in);
int t = s.nextInt();
while(t-->0)
{
int a = s.nextInt();
int b = s.nextInt();
System.out.println(a%b);
}
}
}
```