I need some help in that program to read 2 numbers and print sum of them
the program will be tested on one or more test cases. The first line of the input will be a single integer T, the number of test cases (1 ≤ T ≤ 100). Followed by the test cases, each test case is described in one line which contains 2 integers separated by a single space X Y (1 ≤ X,Y ≤ 100). X and Y are the 2 numbers which you should print the sum of them.
what's the suitable way to write this code as included

Edited by pritaeas: Moved to software.

2 Years
Discussion Span
Last Post by rose_2

Hi @rose_2,

Do you know how to code an "Hello World" type program in C++ ?

If you do, then you can prompt for input.

Then the next thing ... is to code to take in some number ...
and then to take in numbers in a loop and to sum them up.

There are actually many ways to code for this...
but a simple way is demo'd at the following link:

Six Fast Steps to Programming in C++

But code your own version of a solution for your problem ...
and if you get stuck,
then you will need to show us the code you have tried so far.

Then ... we can see how to help you.

Edited by David W


Oh , thanks all i got the answer by myself .. i just missed the mean of test case that i didnt understand the program so well .. it was so simple code
thanks again :))

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.