--> what is the purpose of if statement in this code;
--> what is purpose of (i-1) in average formula;
Code:#include <stdio.h> #define LIMIT 130 int main() { float marks[LIMIT]; float average; float sum=0.0; int i=0; do { printf("\nEnter the marks 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); return 0; }