C program to find the min and max number from a given array
codeaft.c
#include<stdio.h>intmain(){intmin,max;intarr[5]={100,15,8,45,93};min=max=arr[0];for(inti=0;i<5;i++){if(arr[i]>max)max=arr[i];if(arr[i]<min)min=arr[i];}printf("The max number from a given array is %d ",max);printf("The min number from a given array is %d ",min);return0;}
Output
codeaft@codeaft:~$ gcc codeaft.c codeaft@codeaft:~$ ./a.out
The max number from a given array is 100
The min number from a given array is 8
codeaft@codeaft:~$
Dear User, Thank you for visitng Codeaft. If you are interested in technical articles, latest technologies, and our journey further, please follow us on LinkedIn.