Program to Frind the biggest and smallest number from given array set


main()
{
int array[]={5,66,76,34,23,51,94,18,35};
int i,count,large=1,small=32767,n;
clrscr();
for(count=0;count<=9;count++)
{
printf("\n %d-------> %d",count,array[count]);
}

for(count=0;count<=9;count++)
{
if(large < array[count])
{
large = array[count];

}
if(small >= array[count])
{
small=array[count];
}
}
printf("\n largest no in the array is %d",large);
printf("\n smallest no in the array is %d",small);
getch();
}


No comments:

Post a Comment