In this program, we will ask users to enter 2 numbers and print their sum as an output. Learn to calculate the sum of two numbers.

For example, if the user enters 2 numbers 3.2 and 4.5 the output should be 7.7

**C++:**

#include<iostream.h> #include< conio.h> #include<math.h> void main() { clrscr(); float num_1,num_2,add; cout<<"Enter the first number: "; cin>>num_1; cout<<"Enter the second number: "; cin>>num_2; cout<<"The sum of both the numbers is: "<<num_1+num_2; getch(); }

**Output:**

Enter the first number: 4.7 Enter the second number: 3.4 The sum of both the numbers is: 8.1

**Python:**

num_1= float(input("Enter the first number: ")) nun_2= float(input("Enter the second number: ")) print("The sum of both the numbers is:",num_1+nun_2)

**Output:**

Enter the first number: 4.7 Enter the second number: 3.4 The sum of both the numbers is: 8.1

**People are also reading:**

- Python Program to Find Armstrong Number in an Interval
- How to Find Square Root in Python?
- Python Program to Print the Fibonacci sequence
- How many Centimeters in a Foot through Python?
- Python Program to Find the Factorial of a Number
- C Program to Extract a Portion of String
- Python Program to Find the Size of Image
- Rectangle & Pyramids Pattern in C++
- Python Program to Find Factorial of Number Using Recursion
- WAP in C++ & Python & sort an Array Using Bubble Sort