The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 2 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
Can you help with this question please:
Â
1. 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.
2.What is the line of code doing?
char StudentName[100];
3. What would happen if you moved the Set Sum = 0.0 from inside the for loop to right after the declaration?
Â
// C code
// This program will calculate the average of 3 exams for 5 students.
// Developer: Faculty CMIS102
// Date: Jan 31, XXXX
#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;
}