Westonci.ca offers fast, accurate answers to your questions. Join our community and get the insights you need now. Join our platform to connect with experts ready to provide detailed answers to your questions in various areas. Connect with a community of professionals ready to help you find accurate solutions to your questions quickly and efficiently.
Sagot :
Answer:
#include <stdio.h>
#include <limits.h>
/* Define the number of times you are going
to ask the user for input. This allows you
to customize the program later and avoids the
hard coding of values in your code */
#define NUMVALS 5
int main(void)
{
int i = 0;
int curval = 0;
/* Set your initial max as low as possible */
int maxval = INT_MIN;
/* Set your initial min as high as possible */
int minval = INT_MAX;
/* Loop through and ask the user for the defined
number of values */
for (i = 0; i < NUMVALS; i++)
{
/* Ask the user for the next value */
printf("Enter the next value: ");
/* Get the next value from the user */
scanf("%d", &curval);
/* Check to see if this is our biggest or
smallest value yet */
if (curval > maxval)maxval = curval;
if (curval < minval)minval = curval;
}
/* Output the results */
printf("The smallest value entered was: %d \n", minval);
printf("The largest value entered was: %d \n", maxval);
/* End the program */
return 0;
}
Explanation:
Thank you for visiting. Our goal is to provide the most accurate answers for all your informational needs. Come back soon. We appreciate your visit. Our platform is always here to offer accurate and reliable answers. Return anytime. We're glad you chose Westonci.ca. Revisit us for updated answers from our knowledgeable team.