# include<stdio.h>
#include<conio.h>
#define LIMIT 130
int main(){
float marks[LIMIT], average, sum = 0.0;
int i=0;
do {
printf("\nEnter the mark of the student(-1 to finish)");
scanf("%f", &marks[i]);
if (marks[i] >= 0)
sum = sum + marks[i];
}
while(marks[i++] >= 0);
average = sum/(i-1);
printf ("\nThe average is %.2f\n", average);
getch();
}
#include<conio.h>
#define LIMIT 130
int main(){
float marks[LIMIT], average, sum = 0.0;
int i=0;
do {
printf("\nEnter the mark of the student(-1 to finish)");
scanf("%f", &marks[i]);
if (marks[i] >= 0)
sum = sum + marks[i];
}
while(marks[i++] >= 0);
average = sum/(i-1);
printf ("\nThe average is %.2f\n", average);
getch();
}