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,c,i,n;
      scanf("%d",&n);
      for (i=0;i<n;i++)
      {
        scanf("%d\t%d\n",&a,&b);
        c=a%b;
        printf("%d\n",c);
      }

    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