easy c progm to check max no from array

Solutions on MaxInterview for easy c progm to check max no from array by the best coders in the world

showing results for - "easy c progm to check max no from array"
Neele
16 Apr 2020
1#include <stdio.h>
2 #include <conio.h>
3 
4 
5int main()
6{
7    int a[1000],i,n,min,max;
8   
9    printf("Enter size of the array : ");
10    scanf("%d",&n);
11 
12    printf("Enter elements in array : ");
13    for(i=0; i<n; i++)
14    {
15        scanf("%d",&a[i]);
16    }
17 
18    min=max=a[0];
19    for(i=1; i<n; i++)
20    {
21         if(min>a[i])
22		  min=a[i];   
23		   if(max<a[i])
24		    max=a[i];       
25    }
26     printf("minimum of array is : %d",min);
27          printf("\nmaximum of array is : %d",max);
28 
29 
30    return 0;
31}
32