Calculate and prints the sum of three numbers in C++
Input:
Output:
Input:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | /* This program calculate and prints the sum of three numbers input by the user at the keyboard*/ #include <iostream.h> #include <conio.h> using namespace std; int main() { cout<<"Welcome! This program adds\n"; cout<<"Three numbers. Enter three numbers\n"; cout<<"in the form: nnn nnn nnn <return> \n"; int a; int b; int c; cin>> a >> b >> c; // No. are now in a, b and c. Add them. int sum = a + b + c; cout<<" \n The total is:" << sum << endl; cout<<" Thank You!!! Have a Good Day\n"; char cooo; cooo = getch(); cout<<" \n The total is:" << cooo << endl; cout<<" Thank You!!! Have a Good Day\n"; getch(); return 0; } |
Output:
Welcome! This program adds Three numbers. Enter three numbers in the form: nnn nnn nnn <return> 2 3 4 The total is: 9 Thank You!!! Have a Good Day
No comments:
Post a Comment