fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. /* variable definition: */
  5. char StudentName[100];
  6. float ExamValue, Sum, Avg;
  7. int students,exams;
  8. // Loop through 5 Students
  9. for (students=0; students++)
  10. {
  11. // reset Sum to 0
  12. Sum =0.0;
  13. printf("Enter Student Name \n");
  14. scanf("%s", StudentName);
  15. if(students=ooo)
  16. {
  17. break;
  18. }
  19. // Nested Loop for Exams
  20. for (exams=0; exams < 3; exams++)
  21. {
  22. printf ("Enter exam grade: \n");
  23. scanf("%f", &ExamValue);
  24. Sum += ExamValue;
  25. }
  26. Avg = Sum/3.0;
  27. printf( "Average for %s is %f\n",StudentName,Avg);
  28. }
  29. return 0;
  30. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Chris
80
90
100
John
70
90
80
Sally
100
100
100
Pat
50
70
60
Sam
90
95
100
Steve
85
90
95
Joe
78
85
91
ooo
compilation info
prog.c: In function ‘main’:
prog.c:9:28: error: expected ‘;’ before ‘)’ token
 for (students=0; students++)
                            ^
prog.c:15:13: error: ‘ooo’ undeclared (first use in this function)
 if(students=ooo)
             ^~~
prog.c:15:13: note: each undeclared identifier is reported only once for each function it appears in
stdout
Standard output is empty