C++ program that prompts the user to input five decimal numbers, prints the five decimal numbers, converts each decimal number to the nearest integer, adds the five integers and prints the sum and average of the five integers.
###### Posted by Samath
Last Updated: April 06, 2022

Write a program that does the following:
a. Prompts the user to input five decimal numbers.
b. Prints the five decimal numbers.
c. Converts each decimal number to the nearest integer.
e. Prints the sum and average of the five integers.

Code:

```#include <iostream>

using namespace std;

int main()
{
double num1, num2, num3, num4, num5;

cout << "Please enter 5 decimal numbers: \n";
cin >> num1 >> num2 >> num3 >> num4 >> num5;
double result = num1 + num2 + num3 + num4 + num5;

cout << "The sum of all the numbers is: " << static_cast<int>(result) << endl;
cout << "\nThe average of all the numbers is: " << (static_cast<int>(result)/5) << endl;

return 0;
}
```
###### C++ program that prompts the user to input a decimal number and outputs the number rounded to the nearest integer
Samath | Apr 06, 2022
###### Decimal to Binary in C++
Samath | Dec 26, 2014
###### SQL Display two digits after decimal point
SceDev | Feb 08, 2024
###### Python Convert Decimal to Binary or Binary to Decimal
Samath | Jan 09, 2017
###### C++ program that adds, subtracts, multiplies, or divides two integers
Samath | Nov 04, 2014
###### Convert Roman numerals to decimal using Java
Samath | Jan 17, 2024
###### Converting Time To Decimal using C++
Samath | Jan 04, 2017
###### C++ Convert from Decimal to Octal
Samath | Jan 05, 2017
###### Binary to Decimal Conversion in C#
Samath | Jan 10, 2021
###### Java program that prints the sum of the first ten positive integers
Samath | Jan 08, 2021
###### Python to Convert Decimal to Binary, Octal and Hexadecimal
gideonna | Apr 13, 2016
###### C Program to Read integers into an array and Reversing them using Pointers
Samath | Jan 02, 2017
###### Java program that prints the product of the first ten positive integers
Samath | Jan 08, 2021
###### Java program that reads in three integers and prints "in order" if they are sorted in ascending or descending order, or "not in order" otherwise
Samath | Feb 12, 2021