Answer to Question #42134 in C++ for Felicitas O

Question #42134
Write a program for the addition of 2 numbers and output the sum. the program should have 5 different set of values and display the result.
1
Expert's answer
2014-05-08T08:35:17-0400
#include <iostream>
using namespace std;
int main() {
const int SIZE = 5;
int number1[SIZE];
int number2[SIZE];
cout << "You will now be asked to enter 10 numbers. Please enter them as sets" << endl;
for ( int i = 0; i < SIZE; i++ ) {
cout << "Please enter the first number of the set number " << i+1 << endl;
cin >> number1[i];
cout << "Please enter the second number" << endl;
cin >> number2[i];
}
for ( int i = 0; i < SIZE; i++ ) {
cout << "Sum of the set number " << i+1 << " is " << number1[i] + number2[i] << endl;
}
return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS