C++

C++ Program to add two Numbers (Integer/Decimal)1 min read

In this program, we will learn how to add two Numbers in C++ programming language.

To add two numbers in C++, we will ask the user to enter the two number and place the addition of the two number in sum variable of same type and print this variable in the output which is the sum of the two entered numbers as shown here in the following program.

Program to add two Integers




Code:

Output:

Program to add two decimal (float)

Just change the datatype of the variables in the above program to float.

Output:

 

Leave a Comment