Answer:
The program to this question as follows:
Program:
#include <iostream> //defining header file
using namespace std;
int main() //defining main method
{
int x = 10,y = 20,z = 30; //defining integer variable and assigning the value
int sum;//defining integer variable sum
sum =x+y+z;//adding value,that holds by sum variable
cout<<"sum: "<<sum; //print value
return 0;
}
Output:
sum: 60
Step-by-step explanation:
Description of the above code as follows:
- In the above code three integer variable "x, y, and z" is declared, that initialized with the value, that is 10, 20, and 30.
- In the next line, another variable "sum" is declared, that holds the above variable value and add the number.
- Then the print function "cout" is used, which prints sum variable value.