Q.Write a function to accept upto 25 numbers and display highest and lowest number along with all the numbers.
Solution I tried
#include<stdio.h>
#include<conio.h>
void main()
{
int array[25],low,high;
int i;
clrscr();
do
{
printf("Enter a number(0 to terminate)\n");
scanf("%d",&array[i]);
}while(array[i]!=0);
i=0;
low=high=array[0];
while(array[i]!=0)
{
if (low>array[i])
low=array[i];
else if(high<array[i])
high=array[i];
i++;
}
for(i=0;array[i]!=0;i++)
printf("Numbers are %d",array[i]);
printf("Highest is %d,lowest is %d",high,low);
}
Problem is that I am not getting the desired output. For every input I tried, I got the output as highest is 0, lowest is 0.HELP!!!:sad: :!: