Answer to Question #278449 in C for miakaa

Question #278449

Create a program that stores 10 integers. Print the maximum and the minimum integer found in the array.

1
Expert's answer
2021-12-11T01:59:00-0500
#include <stdio.h>
int main()
{
	int n=10,i;
	int numbers[10];
	int maximum =0;
	int minimum =0;
	for (i = 0; i < n; i++)
	{
		printf("Enter number %d: ", (i+1));
		scanf("%d", &numbers[i]);
	}
	maximum=numbers[0];
	minimum=numbers[0];
	for (i = 1 ; i <n; i++)
	{
		if(numbers[i]>maximum){
			maximum=numbers[i];
		}
		if(numbers[i]<minimum){
			minimum=numbers[i];
		}
	}
	printf("\nThe minimum integer is: %d\n", minimum);
	printf("The maximum integer is: %d\n", maximum);


	getchar();
	getchar();
	return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS