Wednesday, 7 March 2018

Add Two Numbers

  1. Add Two Numbers

     
    All submissions for this problem are available.
    Shivam is the youngest programmer in the world, he is just 12 years old. Shivam is learning programming and today he is writing his first program. 

    Program is very simple, Given two integers A and B, write a program to add these two numbers.

    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

    Add A and B and display it.

    Constraints

    • 1  T  1000
    • 1  A,B  10000

    Example

    Input
    3 
    1 2
    100 200
    10 40
    
    Output
    3
    300
    50


    1. Solutions
       
      #include<stdio.h>
    2. int main()
       {
      int i,T,a[1000],b[1000];
      scanf("%d",&T);

      for(i=0;i<T;i++)
      {scanf("%d %d",&a[i],&b[i]);
      }

      for(i=0;i<T;i++)
      printf("\n %d",a[i]+b[i]);     
       }


     
    
    

No comments:

Post a Comment

Reverse The Number

Reverse The Number All submissions for this problem are available. If an Integer   N , write a program to reverse the given number. ...