45.3k views
0 votes
Write a C++ program that stores the integers 50 and 100 in variables and stores the sum of these two in a variable named total. Display the total on the screen.

User AngelGris
by
7.0k points

1 Answer

2 votes

Answer:

Following are the program in c++

#include <iostream> // header file

using namespace std; // namespace

int main() // main function

{

int a=50,b=100,total; // variable declaration

total=a+b; // sum of the two variable a and b

cout<<"The total is:"<<total; // display total

return 0;

}

Output:The total is:150

Step-by-step explanation:

In this program we have declared two variable i.e "a" and "b" of int type which store the value 50 and 10 respectively.After that we adding these two variable and store the sum in total variable finally display the total

User Abg
by
6.1k points