Need a project done?

C++ Programming Developer

Search This Blog

Function to calculate the sum of three floating-point values


/*
Write a Program by defining a function "sum" to calculate the sum of three floating-point values. Enter the values and then pass these values to function as arguments. Print the result on Screen.
*/

#include <iostream>
using namespace std;

inline float Sum (float,float,float);



int main()

{
float Num1, Num2, Num3;
cout<<"Number 1: "; cin>>Num1;
cout<<"Number 2: "; cin>>Num2;
cout<<"Number 3: "; cin>>Num3;

cout<<"Sum: "<<Sum (Num1,Num2,Num3) << endl;

return 0;
}

inline float Sum (float Num1, float Num2, float Num3)
{
return Num1+Num2+Num3;
}

1 comment:

"Don't let anyone ever make you feel like you don't deserve what you want."