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();

}

Related Links :

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


If you face any Problem in viewing code such as Incomplete "For Loops" or "Incorrect greater than or smaller" than equal to signs then please collect from My Web Site CLICK HERE


More Useful Topics...

 

History Of C..

In the beginning was Charles Babbage and his Analytical Engine, a machine
he built in 1822 that could be programmed to carry out different computations.
Move forward more than 100 years, where the U.S. government in
1942 used concepts from Babbage’s engine to create the ENIAC, the first
modern computer.
Meanwhile, over at the AT&T Bell Labs, in 1972 Dennis Ritchie was working
with two languages: B (for Bell) and BCPL (Basic Combined Programming
Language). Inspired by Pascal, Mr. Ritchie developed the C programming
language.

My 1st Program...


#include
#include
void main ()
{
clrscr ();
printf ("\n\n\n\n");
printf ("\t\t\t*******Pankaj *******\n");
printf ("\t\t\t********************************\n");
printf ("\t\t\t\"Life is Good...\"\n");
printf ("\t\t\t********************************");
getch ();
}

Next Step...


#include
#include

void main ()
{
clrscr ();
printf ("\n\n\n\n\n\n\n\n");
printf ("\t\t\t --------------------------- \n\n");

printf ("\t\t\t | IGCT, Info Computers, INDIA | \n\n");
printf ("\t\t\t --------------------------- ");

getch ();

}

Hits!!!