You need to write a menu driven program (Menu needs to display again and again till user chooses to select option 4 to exit).
The program allows a user to enter five numbers and then asks the user to select a choice from a menu. The menu should offer following options –
1. Display the smallest number entered
2. Display the largest number entered
3. Display the sum of the five numbers entered
4. Display the average of the five numbers entered.
5. Exit
You must use a "switch" statement in your code to determine what action to take. This menu needs to be repeated again and again till the user chooses option 5 to quit. Provide an error message if an invalid choice is entered.
Run the program six times, once with each option from 1 to 4 then an invalid option and at the end with option 5 to quit. Each run is to use the following set of data (Note that your program needs to work with any five numbers entered by the user):
18, 21, 17, 44, 9.
Submit a word file with IPO, source code and the screenshots of the results of the five program runs.
insertThis is what I have so far. Can anyone help me ?Code:int main () { int userNumber = 0, sum = 0, count = 0, highNum = 0, lowNum = 0, lastNum = 0; double average; printf("Enter a number greater than 0: (Enter -4 to stop)\n"); scanf("%i", &userNumber); highNum = userNumber; lowNum = userNumber; while(userNumber != -4) { if(userNumber > lowNum && userNumber > highNum) highNum = userNumber; count = count + 1; sum = sum + userNumber; printf("Enter a number: (-4 to stop)\n"); scanf("%i", &userNumber); } average = (double)sum / count; printf("The sum is: %i\n", sum); printf("%i numbers were input\n", count); printf("The average is %.2lf\n", average); printf("The highest number entered was: %i\n", highNum); printf("The last number entered was: %i\n", lastNum); printf("The lowest number entered was: %i\n", lowNum); return 0; }