Welcome

>>>Welcome to my "CODE BAZAR"
Code marshal
URI online judge
Others
Code marshal
URI online judge
Others
Code marshal
URI online judge
Others

Update ✔✔✔ Upcoming programming book (.pdf) "Programming Contest (data structures and algorithms) by Md. Mahbub Hasan & "Graph Algorithms" by Safayat Asraf "****** Date: 20 March, 2019****Hazrat Ali****

Sunday 30 October 2016

O. Multiple Test Case

Problem link

Score: 1

CPU: 1s
Memory: 512MB

In Programming Contest you have to handle multiple test cases for a single problem. Suppose for a problem where you have to calculate the summation of two numbers T times, you have to use loops to repeat the process.
Now you are going to practice this here because in coming Intersection Programming Contest you have to handle this.
Input
First you will be given an positive integer T (1< T < 100), the number of test case which denotes the number of times your program will be tested. For each test case you will be given two space separated integer a and b ( 1 < a, b < 100000) in different lines.
Output
For each test case print “Case X: S”. Where X is the number of test case and S is the summation of given two numbers.

Sample

InputOutput
3 1 6 9 5 10 26 Case 1: 7 Case 2: 14 Case 3: 36


Solution

#include<stdio.h>
int main()
{
    int a,b,i,t,res=0;
    scanf("%d",&t);
    for(i=1;i<=t;i++){
        scanf("%d%d",&a,&b);
        res=a+b;
        printf("Case %d: %d\n",i,res);
    }
    return 0;
}


No comments:

Post a Comment