C++ Online Compiler
Example: C++ Program to Find the Sum of Two Real Numbers
C
C++
C#
Java
Python
PHP
main.cpp
STDIN
Run
// C++ program to find the sum of two real numbers #include <iostream> using namespace std; // It's the main function of the program int main() { float p, q; // Step-1 Take inputs from the user cout << "Enter two float values::\n"; cin >> p >> q; cout << "Result:: " << p << " + " << q << " = "; // Step-2 Calculating the sum of input numbers p = p + q; // Step-3 Final output of the program cout << p << endl; return 0; }
5.23 7.29
Output
Clear
ADVERTISEMENTS