Find Remainder ||codechef||beginner solution ||programming info


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 USING C LANGUAGE:-
#include <stdio.h> 
int main() {
	// Read the number of test cases.
	int T,i;
	scanf("%d", &T);
	for(i=0;i<T;i++) {
		// Read the input a, b
		int a, b;
		scanf("%d %d", &a, &b);

		// Compute the ans.
		// Complete this line.
		int ans = a%b;
		printf("%d\n", ans);
	}

	return 0;
}

Share:

1 comment:

  1. factorial hundred In the last few days, the “factorial of 100” is one of the top subjects and a lot of maths geeks compute it using voice assistants such as Alexa, Shiri, etc.
    factorial hundred In the last few days, the “factorial of 100” is one of the top subjects and a lot of maths geeks compute it using voice assistants such as Alexa, Shiri, etc.
    factorial hundred In the last few days, the “factorial of 100” is one of the top subjects and a lot of maths geeks compute it using voice assistants such as Alexa, Shiri, etc.

    ReplyDelete

Translate

Recommended platforms

  1. codechef
  2. hackerrank
  3. codeforces
  4. leetcode
  5. hackerearth

Popular Posts

programming_info. Powered by Blogger.

Blog Archive

Recent Posts

other platforms

  • geeks for geeks
  • w3schools
  • codepen
  • skillshare
  • udemy

Pages

reader support Support