Question: Using C write this program Your program should allow the user to input 5 integers, will store the integers in an array, and will use
Using C write this program
Your program should allow the user to input 5 integers, will store the integers in an array, and will use for loops to process the array. The program should carry out the following logic flow:
Ask the user to enter the 5 integers - use a for loop to allow the user to enter the values, and store them in an array
Iterate through the for loop to display the numbers entered by the user
Ask the user if they would like the largest or smallest number in the array displayed
Allow the user to enter their choice (L/S), and execute the appropriate logic
I have created a skeleton of the code necessary for you to complete this exercise. You can start with this code and build up to the finished product. In addition, the image below gives a visual representation of the logic flow.
Code provided #include#include #include int main(void) { int numbers[5] = {0}, lcv = 0, value = 0; char choice = 0; printf("Enter 5 numbers to be stored in the array "); for (lcv = 0; lcv Process terminated. Press any key to close window. Enter 5 numbers to be stored in the array Please enter element 1 -1? Please enter element 2: 0 Please enter element 3: 500 Please enter element 4 -2002 Please enterelement 5: 18 Here are the numbers you entered Element 1: -17 Element 2 0 Element 3: 500 Element 4-2002 Element 5: 18 Do you want the largest or smallest number to be displayed L/S): S The smallest number entered is: 2002
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
