Saturday, August 18, 2018

REMAINDER


  • Problem Description

    Write a program to find the remainder when two given numbers are divided. he first line contains an integer T, total number of test cases. Then follow T lines, each line contains two Integers A and B. Find remainder when A is divided by B
  • CODING ARENA
  • #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;
    }
  • Test Case 1

    Input (stdin)
    2
    
    1 2
    
    100 200
    
    
    Expected Output
    1
    
    100
  • Test Case 2

    Input (stdin)
    3
    
    39 10
    
    5 2
    
    15 8
    
    
    Expected Output
    9
    
    1
    
    7

No comments:

Post a Comment