This is the question.
write a program that prompts the user to input five decimal numbers. the program should then add the five decimal numbers, convert the sum to the nearest integer,m and print the result.
This is what I've gotten so far:
// p111n9.cpp : Defines the entry point for the console application.
//
#include <iostream>
using namespace std;
double a, b , c , d , e, f;
int main(int argc, char* argv[])
{
cout << "enter 5 decimals: " << endl;
cin >> a >> b >> c >> d >> e;
f = a + b + c + d + e;
return 0;
}
Now I just need to convert the sum(f
) to the nearest integer, m
and print the result. How do I do this?