Manipulators:
- Manipulators are the Operators that are used to Format the Data Display.
- Example: endl
- It is included in the <iomanip> Header File.
#include<iostream.h>
#include<iomanip.h>
int main()
{
float n1, n2 ;
float Sum, Average ;
Cout<< " Enter the Value of Two Numbers" << "endl";
Cin>> n1;
Cin>> n2;
Sum = n1+ n2;
Average = Sum / 2 ;
Cout<< " Sum= " << Sum << "\n" ;
Cout<< " Average= " << Average << "\n" ;
return(0); // It is also Written as return 0;
} // End of main()
Output:
Enter the Value of Two Numbers
5 10
Sum= 15
Average= 7.5
0 Response to "Write a C++ Program to Compute the Sum and Average of Two Numbers"
Post a Comment