Q:

Write a C++ Program to Add Two Numbers

belongs to collection: C++ Basic Solved Programs

0

Write a C++ Program to C++ Program to Add Two Numbers. Here’s simple Program to Add Two Numbers in C++ Programming Language.

All Answers

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

In this program, user is asked to enter two integers. Then, the sum of those two integers is stored in a variable and displayed on the screen.

 
 

Here is source code of the C++ Program to Add Two Numbers. The C++ program is successfully compiled and run(on Codeblocks) on a Windows system. The program output is also shown in below.


SOURCE CODE : :

/*  C++ Program to Addition of Two Numbers  */

#include <iostream>
using namespace std;

int main()
{
    int first, second, sum;

    cout << "Enter 1st integer :: ";
    cin >> first;
    cout << "\nEnter 2nd integer :: ";
    cin >> second;

    sum = first + second;

    cout<<"\nSum of Two Numbers [ "<<first<<" + "<<second<<" ] = "<<sum<<"\n";

    return 0;
}

Output : :


/*  C++ Program to Addition of Two Numbers  */

Enter 1st integer :: 11

Enter 2nd integer :: 65

Sum of Two Numbers [ 11 + 65 ] = 76

Process returned 0

Above is the source code for C++ Program to Add Two Numbers which is successfully compiled and run on Windows System.The Output of the program is shown above .

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

total answers (1)

C++ Basic Solved Programs

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
C++ Program to Find Quotient and Remainder of 2 nu... >>
<< Write a C++ Program to Display Number (Entered by ...