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

import java.util.*;
class InputNumbers
{
public static void main(String[] args)
{
double num[]=new double[5];
Scanner input=new Scanner(System.in);
System.out.println("Enter 5 decimal numbers:");
for(int i=0;i<num.length;i++){
num[i]=input.nextDouble();
}
System.out.println("Decimal numbers are:");
for(int i=0;i<num.length;i++){
System.out.println(num[i]);
}
int sum=0;
int number[]=new int[5];
for(int i=0;i<number.length;i++){
number[i]=(int)(Math.round(num[i]));
sum+=number[i];
}
System.out.println("Sum of 5 integers: "+sum);
int average=sum/5;
System.out.println("Average of 5 integers: "+average);
}
}