Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need help with this problem in C programming: Write a complete program that pr

ID: 3642995 • Letter: I

Question

I need help with this problem in C programming:

Write a complete program that prompts how many students? reads the number.
Make a loop for that many students, prompts the first student for name and how many tests, get name, number of tests. Make a loop to sum all of her/his tests and compute the average of her/his test. Your program should output student name, test average and a letter grade. NOTE: to get credit you must write at least one function.
Note: To assign the letter grade use (if average >= 90, A, >=80, B etc.).


So far this is what I have:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>


int main (void)
{
char name [30];
char GetGrade (int sum);
int scores[100], sum = 0;
int t, i, testnum, num;

printf("How many students: ");
scanf("%d", &num );
for( i=0; i < testnum; i++ );
{
printf("How many tests: ");
scanf("%d", &testnum );
for( i=0; i < testnum; i++ );

{
printf("What is the students's name: " );
scanf( "%s", &name );
}
printf( "Please enter the %d test scores. ", testnum);

for( i = 0; i < testnum; i++ )
{
printf( "#%2d > ", i+1 );
scanf( "%d", &scores[i] );
}
for( i = 0; i < testnum; i++ )
{
sum=sum + scores[i] / testnum;
}
printf( "The average score for %s is %d ", name, sum);
}



{
char GetGrade;


if( sum >= 90)
t = 'A';
else if( sum >=80)
t = 'B';
else if( sum >=70)
t = 'C';
else if( sum >=60)
t = 'D';
else
t = 'F';
}
printf( "The average grade for %s is %c ", name, t);

return t;
}


Any help is appreciated.

Thank you

Explanation / Answer

#include #include #include int main (void) { char name [30],g; int scores[100], sum = 0; int t, i, testnum, num,a[20],j,k; float t; printf("How many students: "); scanf("%d", &num ); for( j=0; j =70) g = 'C'; else if( t >=60) g = 'D'; else g = 'F'; printf( "The average grade for student named %s is %c ", name, g); } }