search Max & Min numbers

/*program for searching minimum and maximum number in ten numbers*/

#include<stdio.h>
#include<conio.h>
int main()
{
 int arr[10];
 int i,num,min,max;
 for(i=0; i<10; i++)
 {
   printf("Enter %d Number : ",i+1);
   scanf("%d",&arr[i]);
 }
 min=max=arr[0];
 for(i=0; i<10; i++)
 {
   if(arr[i] < min)
      min=arr[i];
   else if(arr[i] > max)
      max=arr[i];
 }
 printf("\nMaixmum number is %d",max);
 printf("\nMinimum number is %d",min);
 getch();
 return 0;
}

      Output of above program :

Enter 1 Number : 55
Enter 2 Number : 36
Enter 3 Number : 45
Enter 4 Number : 78
Enter 5 Number : 156
Enter 6 Number : 11
Enter 7 Number : 1256
Enter 8 Number : 2
Enter 9 Number : 596
Enter 10 Number : 367

Maximum number is : 1256                       
Minimum number is :                        

Comments