ulvis.paste.net

Paste Search Dynamic
Recent pastes
students
  1. // Developer: Faculty CMIS102
  2.         // Date: Jan 31, XXXX
  3.         #include <stdio.h>
  4.         int main ()
  5.         {
  6.           /* variable definition: */
  7.           char StudentName[100];
  8.           float ExamValue, Sum, Avg;
  9.           int students,exams,number_students;
  10.  
  11.            //input the number students
  12.            printf("input how many students:\n");
  13.            scanf("%d", &number_students);
  14.  
  15.            // Loop through # Students
  16.           for (students=0; students < number_students ; students++)
  17.           {
  18.              // reset Sum to 0
  19.              Sum =0.0;  
  20.              printf("Enter Student Name \n");
  21.              scanf("%s", StudentName);  
  22.              // Nested Loop for Exams
  23.             for (exams=0; exams < 3; exams++)
  24.             {
  25.                 printf ("Enter exam grade: \n");
  26.                 scanf("%f", &ExamValue);
  27.                 Sum += ExamValue;
  28.             }  
  29.             Avg = Sum/3.0;
  30.             printf( "Average for %s is %f\n",StudentName,Avg);
  31.           }
  32.           return 0;
  33.         }
Parsed in 0.006 seconds