Problem Description
Write a program to find the remainder when two given numbers are divided.
Input
The first line contains an integer T, total number of test cases. Then follow T lines, each line contains two Integers A and B
Output
Find remainder when A is divided by B.
Constraints
1<=T<=1000
1<= A, B <=10000Test Case 1
Input (stdin)3 1 2 100 200 10 40
Expected Output1 100 10
Test Case 2
Input (stdin)5 100 1000 1 3 200 20 1237 1234 1234 789
Expected Output100 1 0 3 445
Program
#include <stdio.h> int main() { int a,b,t,i; scanf("%d",&t); for(i=0;i<t;i++) { scanf("%d%d",&a,&b); printf("%d\n",(a%b)); } return 0; }
No comments:
Post a Comment
Note: only a member of this blog may post a comment.