fork download
  1. // C code
  2. // This program will calculate the average of 3 exams for students.
  3. // Developer: ERIKA HOTTINGER CMIS102
  4. // Date: Oct 22, 2017
  5. #include <stdio.h>
  6. int main ()
  7. {
  8. /* variable definition: */
  9. char StudentName[100];
  10. float ExamValue, Sum, Avg;
  11. int students,exams;
  12. // Loop through Students
  13. for (students=0; students++)
  14. {
  15. // reset Sum to 0
  16. Sum =0.0;
  17. printf("Enter Student Name: \n\n");
  18. scanf("%s", StudentName);
  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\n\n\n",StudentName,Avg);
  28. }
  29. return 0;
  30. }
  31.  
  32.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c: In function ‘main’:
prog.c:13:30: error: expected ‘;’ before ‘)’ token
   for (students=0; students++)
                              ^
stdout
Standard output is empty