3. Input + Addition
by CodeChum Admin
Hopefully you haven't forgotten about your previous lesson, because you're going to need it for this one.
Instructions:
Input two integers (one per line) and make sure to store them in variables.
Add the two integers and print out their sum!
Input
Two lines containing an integer on each.
6
6
Output
A line containing the addition of the two inputted integers.
12
#include <iostream>
using namespace std;
int main() {
int sum=0;
int number1;
int number2;
cin>>number1;
cin>>number2;
sum=number1+number2;
cout<<sum<<"\n";
system("pause");
return 0;
}
Comments
Leave a comment