ComputerScienceExpert

(11)

$18/per page/

About ComputerScienceExpert

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Applied Sciences,Calculus See all
Applied Sciences,Calculus,Chemistry,Computer Science,Environmental science,Information Systems,Science Hide all
Teaching Since: Apr 2017
Last Sign in: 103 Weeks Ago, 3 Days Ago
Questions Answered: 4870
Tutorials Posted: 4863

Education

  • MBA IT, Mater in Science and Technology
    Devry
    Jul-1996 - Jul-2000

Experience

  • Professor
    Devry University
    Mar-2010 - Oct-2016

Category > Programming Posted 02 May 2017 My Price 9.00

Modify the code to be able to input an undetermined number

Please help! I cannot figure this code out at all! I keep getting a Runtime error!

 

Modify the code to be able to input an undetermined number of students. You will still only have 3 exams for each student. Support your experimentation with screen captures of executing the new code

 

#include <stdio.h>

int main ()

{

  /* variable definition: */

  char StudentName[100];

  float ExamValue, Sum, Avg;

  int students,exams;

   // Loop through 5 Students

  for (students=0; students <5 ; students++)

  {

     // reset Sum to 0

     Sum =0.0; 

     printf("Enter Student Name n");

     scanf("%s", StudentName);  

     // Nested Loop for Exams

    for (exams=0; exams < 3; exams++)

    {

        printf ("Enter exam grade: n");

        scanf("%f", &ExamValue);

        Sum += ExamValue;

    }  

    Avg = Sum/3.0;

    printf( "Average for %s is %fn",StudentName,Avg);

  }

  return 0;

}

Answers

(11)
Status NEW Posted 02 May 2017 08:05 AM My Price 9.00

-----------

Not Rated(0)