Finding Maximum & Minimum number from an array

#include
#include

void main()
{
int i,max,min,max_index,min_index;
int num[10];
clrscr();

printf("\n\n\n\t Program for finding Maximum & Minimum number from an
array");

printf("\n\n\n\t\t\t Enter any 10 Numbers");

for(i=0;i<10;i++)
{
printf("\n\n\t\t\t Enter number for num[%d] = ",i);
scanf("%d",&num[i]);
}

max=0;
min=num[0];

for(i=0;i<10;i++)
{
if(num[i]>max)
{
max=num[i];
max_index=i;
}
if(num[i]<=min)
{
min=num[i];
min_index=i;
}
}

printf("\n\n\t\t\t Maximum number is %d at index %d",max,max_index);
printf("\n\n\t\t\t Minimum number is %d at index %d",min,min_index);

getch();

}

11 comments:

  1. Thanks Yarr add some program on trignometric Function..

    ReplyDelete
  2. Thanks Good Collection Keep it Up....

    ReplyDelete
  3. Thanks Friends For Your Appreciations...

    ReplyDelete
  4. Thanks Brother..Really Big Collection..Keep it Upe..Add Some Projects Please..

    ReplyDelete
  5. i think this program is good but can you help me to write this same program in C++ lanuguage.............as soon as possible....
    thanks this program is also beneficial for me.......

    ReplyDelete
  6. thankz 22222222222222222 mch sir with the help of you and this program i hadn't faced any sort of problem thankz again

    ReplyDelete
  7. program find max and min m*n matrix Sagar Zodage
    if u want to any program solution then mail me zodagesagar@gmail.com

    #include
    #include
    void main()
    {
    int m,n,i,j;
    int a[50][50];
    int max,min;
    clrscr;

    printf("\n Enter M * N ");
    scanf("%d%d",&m,&n);

    for(j=0;jmin) min=a[j][i];


    }
    }
    printf("\n The Max Number Is=%d",max);
    printf("\n The Min Number Is=%d",min);


    getch();

    }

    ReplyDelete