Program to delete duplicates from a link list

Find Remainder | Codechef solution

Problem (Find Remainder | Codechef solution):-

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

Input of Find Remainder | Codechef solution

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

Code:-

#include <bits/stdc++.h> 

using namespace std;

int main() {
    // Read the number of test cases.
    int T;
    scanf("%d", &T);
    while (T--) {
        // Read the input a, b
        int a, b;
        scanf("%d %d", &a, &b);
      
        // Compute the ans.
        // Complete the below line.
        int ans = a%b;
        printf("%d\n", ans);
    }

    return 0;
}

Recommended Post:-

codechef problems:-

 

 

Wipro :-

 

 

Infytq :-

 

 

Key Points;-

Hackerrank:-

C-tutorial:-

 

See more:-

 

Leave a Reply

Your email address will not be published.