I have an exercise to do and I am just starting. The exercise asksto write a program that will prompt the user to list test scores and then print the lowest, highest and the average of the test scores. Each test score is an integer greater than or equal to 0. Now the user terminates the list by entering ANY negative number. Pretty simple right? lol well not for a NOOB! ANyways Hers what I started with but as of now I am only trying to enter the numbers and get the break by entering a negative number and then show the average. I havent even attempted to print high/low yet. The problem is that I cant get out of the loop so when I start my program i cant get out of it by using negative numbers. Thanks!
Code:main()
{
int i, num, avg, high, low;
printf("Enter test scores (-1 to terminate list)\n");
for (i=1; i>=0; i++)
{
scanf("%d", &num);
i+=num;
if (i<0)
{
break;
}
i = i+1;
}
printf("Average: %0.2f\n", num/i);
}