O. Multiple Test Case
Problem link
Score: 1
CPU: 1s
Memory: 512MB
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
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 “
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
Input | Output |
---|---|
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