Sunday, 5 January 2014

TO FIND THE 2ND MINIMUM NUMBER FROM ARRAY WITHOUT SORTING...!!!!

#include<stdio.h>
int main()
{
    int arr[10],count[10]={0};
    int x,y;
    for(x=0;x<10;x++)
    scanf("%d",&arr[x]);
    int max=0;
    for(y=0;y<10;y++)
    {
       for(x=0;x<10;x++)
       {
       if(arr[y]>arr[x])
       count[y]++;
       }
    }
     for(x=0;x<10;x++)
     {
      if (count[x]==1)
      printf("2nd Minimum number is:%d",arr[x]);
     }
    getch();
    return 0;
}

No comments:

Post a Comment