Q:

Write a program in C++ to print the sum of two numbers using variables

0

Write a program in C++ to print the sum of two numbers using variables

Sample Output:

 Print the sum of two numbers :                                        
-----------------------------------                                    
 The sum of 29 and 30 is : 59

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

#include <iostream>
using namespace std;
 
int main()
{
    cout << "\n\n Print the sum of two numbers :\n";
	cout << "-----------------------------------\n";
	int a;
	int b;
	int sum;
	a=29;
	b=30;
	sum=a+b;
	cout << " The sum of "<< a << " and "<<b <<" is : "<< sum <<"\n\n" ;
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now