C++ Program to Add Two Numbers

In this example, we take two numbers from the user and add those two numbers and display the sum. The below example takes two number and stores it in the variable “a” and “b” respectively. Another variable “sum” is declared that is used to store the addition of two numbers entered by the user.

Example:

The output of the above program is:

Output:

Enter two number: 5
5
Sum of two number is: 10

In the output section of this program, at first, it displays “Enter two number”. After the user entered the numbers, the compiler displays the sum of these two numbers as shown above.

SHARE C++ Program to Add Two Numbers

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

Share