Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program which reads pairs of numbers and prints the sum of the integers

ID: 3629988 • Letter: W

Question

Write a program which reads pairs of numbers and prints the sum
of the integers from the first in each pair to the second. For
example, if first pair of numbers is 3 and 7, the program will
print 25 since 3 + 4 + 5 + 6 + 7 = 25. You may assume both numbers
in the pair are positive integers. If the first number is greater
than the second, print
Second number is smaller.
If the two numbers are the same, the sum is just that number. For
example, the program will print 5 if the input is 5 5.

You will repeat this until end of file.
See the sample run below for exact wording for the output.

Assume all inputs will be positive integers, you don't need to check this.
While running the program, Ctrl-d triggers an end-of-file. That is, you
signal the end of the input data in HiC by holding down the control key
("Ctrl" on your keyboard in the lower left corner) and pressing the d.

Below is a sample run where the input is:

3 7
1 9
5 4
5 5
<Ctrl-d> - press <Ctrl-d>, don't type it in!


You need to match the output exactly.

----------------------------------------------------------------------

Sample Run:

Enter two positive integers: 3 7
Sum is: 25
Enter two positive integers: 1 9
Sum is: 45
Enter two positive integers: 5 4
Second number is smaller.
Enter two positive integers: 5 5
Sum is: 5
Enter two positive integers:

----------------------------------------------------------------------

lab4.cpp has the shell for the program. You should copy this file
from the S drive and complete the program by following the DO tasks.

Hints:
1. Watch your status line to know when the program is finished.
2. You have been given the priming read/cin statement.

Explanation / Answer

Dear Friend here is the program u want PLEASE RATE #include using namespace std; int main() { int num1,num2; int sum=0; coutnum1>>num2) { if(num1>num2) cout
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote