Question

Write a program for a professor to calculate the average grade of a student. The program...

Write a program for a professor to calculate the average grade of a student. The program should accept as many grades as the professor wants to enter. Therefore, ask the professor for the first grade, the second grade, and so on until the professor enters a negative value. A negative value indicates that the professor is finished entering grades. Once the professor is finished, your program should output: a) the average grade of the student b) the letter grade of the student

without for statement

C code

0 0
Add a comment Improve this question Transcribed image text
Answer #1

#include<stdio.h>

int main(){
   double score,avg=0,sum=0;
   int n=0;
   char grade;
   printf("Enter grade %d: ",n+1);
   scanf("%lf",&score);
   while(score>=0){
       sum+=score;
       n+=1;
       printf("Enter grade %d: ",n+1);
       scanf("%lf",&score);
   }
   avg=sum/n;
   if(avg>90){
       grade='A';
   }
   else if(avg>80){
       grade='B';
   }
   else if(avg>70){
       grade='C';
   }
   else if(avg>60){
       grade='D';
   }
   else
   grade='F';
   printf("Average score: %.2f Letter Grade: %c ",avg,grade);
   return 0;
}

Add a comment
Know the answer?
Add Answer to:
Write a program for a professor to calculate the average grade of a student. The program...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a program that asks the user for a student name and asks for grades until...

    Write a program that asks the user for a student name and asks for grades until the user enters a non-number input, it should then ask if the user wants to enter another student, and keep doing the process until the user stops adding students. The student’s must be stored in a dictionary with their names as the keys and grades in a list. The program should then iterate over the dictionary elements producing the min, max, and mean of...

  • Write a C++ program that will provide a user with a grade range if they enter...

    Write a C++ program that will provide a user with a grade range if they enter a letter grade. Your program should contain one function. Your function will accept one argument of type char and will not return anything (the return type will be void), but rather print statements to the console. Your main function will contain code to prompt the user to enter a letter grade. It will pass the letter grade entered by the user to your function....

  • Write a program that prompts the user for student grades, calculates and displays the average grade...

    Write a program that prompts the user for student grades, calculates and displays the average grade in the class. The user should enter a character to stop providing values.

  • using C# Write a program which calculates student grades for multiple assignments as well as the...

    using C# Write a program which calculates student grades for multiple assignments as well as the per-assignment average. The user should first input the total number of assignments. Then, the user should enter the name of a student as well as a grade for each assignment. After entering the student the user should be asked to enter "Y" if there are more students to enter or "N" if there is not ("N" by default). The user should be able to...

  • C ++ . In professor Maximillian’s course, each student takes four exams. A student’s letter grade...

    C ++ . In professor Maximillian’s course, each student takes four exams. A student’s letter grade is determined by first calculating her weighted average as follows:                                                 (score1 + score2 + score3 + score4 + max_score) weighted_average = -----------------------------------------------------------------------                                                                                                 5 This counts her maximum score twice as much as each of the other scores. Her letter grade is then a A if weighted average is at least 90, a B if weighted average is at least 80...

  • You have been hired by the CS Department to write code to help synchronize a professor...

    You have been hired by the CS Department to write code to help synchronize a professor and his/her students during office hours. The professor, of course, wants to take a nap if no students are around to ask questions; if there are students who want to ask questions, they must synchronize with each other and with the professor so that only one person is speaking at any one each student question is answered by the professor, and time, no student...

  •   -You are going to write a program to help me determine the final grade and...

      -You are going to write a program to help me determine the final grade and calculate some summary stats. The steps are described below: 1. First, create a dictionary of 10 students with student name as key and score as value. •For simplicity, name students as student 1, student 2, etc. Scores are random integers from 0-100 2. Calculate the average score in the class 3. Determine the letter grade based on the following scheme :•A if score >=...

  • C++ Write a program to calculate final grade in this class, for the scores given below...

    C++ Write a program to calculate final grade in this class, for the scores given below . Remember to exclude one lowest quiz score out of the 4 while initializing the array. Display final numeric score and letter grade. Use standard include <iostream> Implementation: Use arrays for quizzes, labs, projects and exams. Follow Sample Output for formatting. May use initialization lists for arrays. Weight distribution is as follows: Labs: 15% Projects: 20% Quizzes: 20% Exams: 25% Final Project: 20% Display...

  • Create a MIPS program that does the following: 4. Determine the letter grade a. Use the...

    Create a MIPS program that does the following: 4. Determine the letter grade a. Use the floating point calculated average to determine the letter grade. You will need to research the instructions to use to do comparisons with floating point numbers. (see Course Resources) b. Use the following chart: 90 - 100 80 - 89 70 - 79 ............. 60 - 69.............. <60 ..................... ............... 5. Display a message and the letter grade. 6. Your output should look similar to...

  • Java Program: In this project, you will write a program called GradeCalculator that will calculate the...

    Java Program: In this project, you will write a program called GradeCalculator that will calculate the grading statistics of a desired number of students. Your program should start out by prompting the user to enter the number of students in the classroom and the number of exam scores. Your program then prompts for each student’s name and the scores for each exam. The exam scores should be entered as a sequence of numbers separated by blank space. Your program will...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT