Using Arrays Function Having problem completing it Please i nid for tom.

closed account (Nvq4jE8b)
#include <iostream.h>

int main()
{
int grade[10],sum=0,average=0,max=0;
int min=0;

for (int i=0;i<10;i++)
{
cout<<"Enter grade"<<(i+1)<<" ";
cin>>grade[i];
sum+=grade[i];
average = sum / 10;
if(grade[i] > max)
{
max=grade[i];
}
if(grade[i] < min)
{
min=grade[i];
}
}
cout<<"\nThe average is:"<<average;
cout<<"\nThe Maximum is:"<<max;
cout<<"\nThe Minimum is:"<<min;


return 0;
}
The minimum is giving me wrong invalid output please help thanx :D
You initialize min to 0, which means that if the only score you enter is 85, the
minimum of 85 and 0 is 0.
closed account (Nvq4jE8b)
i did that as well but then the maximum giving is also giving invalid output even though i removed the initialization of both of them???
I didn't say anything about changing the initialization of max.

closed account (Nvq4jE8b)
Thank you mate u Rock hehehe thanks a lot u helped me a lot :D
closed account (Nvq4jE8b)
sorry for the double post its and emergency :D
Topic archived. No new replies allowed.