Answer to Question #278497 in C for Gilleo

Question #278497

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



1
Expert's answer
2021-12-11T10:00:51-0500
#include<stdio.h>
int main(){
	printf("Enter 10 integers\n");
	int arr[10];
	int i, j, k;
	for(i =0 ; i<10; i++){
		scanf("%d", &arr[i]);
	}
	
	int max = arr[0], min = arr[0];
	for(j=0; j<10; j++){
		if(arr[j]>max){
			max = arr[j];
		}
	}
	
		for(k=0; k<10; k++){
		if(arr[k]<min){
			min = arr[k];
		}
	}
	
	printf("The maximum is %d and minimum is %d", max, min);
}

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