fork download
  1. #include <stdio.h>
  2.  
  3. int main ()
  4. {
  5. /* variable definition: */
  6. char StudentName[100];
  7. float ExamValue, Sum, Avg;
  8. double max;
  9. int students,exams;
  10.  
  11. // Loop through 5 Students
  12.  
  13. for (students=1;students<max;students++)
  14. {
  15. // reset Sum to 0
  16. Sum =0.0;
  17. printf("Enter Student Name\n");
  18. scanf("%s", StudentName);
  19. // Nested Loop for Exams
  20.  
  21. for (exams=0; exams < 3; exams++)
  22. {
  23. printf("Enter exam grade: \n");
  24. scanf("%f", &ExamValue);
  25. Sum += ExamValue;
  26. }
  27. Avg = Sum/3.0;
  28. printf( "Average for %s is %f\n",StudentName,Avg);
  29. }
  30. return 0;
  31. }
Success #stdin #stdout 0s 2164KB
stdin
John:
90.0 80.0 100.0
Jim:
80.0 70.0 90.0
Joe:
70.0 100.0 100.0
Sally: 
100.0 95.0 91.0
Sam:
30.0 54.0 68.0 
stdout
Standard output is empty