Question

In C programming Write a program that displays the appropriate prompt to input 5 scores. Once...

In C programming

Write a program that displays the appropriate prompt to input 5 scores. Once the user inputs the five integer values, your program calculates and prints the average. You do not need to declare five different variables, think of how you can get away with a single variable. The second part of this program will print A if the average of these 5 numbers is greater than or equal to 90 but less than 100, B if greater than or equal to 80 but less than 90 …. or F if the average is less than 60.

0 0
Add a comment Improve this question Transcribed image text
Answer #1
#include <stdio.h>

int main()
{
   char letter;
   int val = 0, i = 0, s = 0;
   double score;
   while(i<5){
      printf("Enter score: ");
      scanf("%d",&val);
      s += val;
      i++;
   }
   score = s/5.0;
   if(score < 60)
        letter = 'F';
    else if(score < 70)
        letter = 'D';
    else if(score < 80)
        letter = 'C';
    else if(score < 90)
        letter = 'B';
    else
        letter = 'A';
    printf("
Letter grade = %c
",letter);
    return 0;
}

Add a comment
Know the answer?
Add Answer to:
In C programming Write a program that displays the appropriate prompt to input 5 scores. Once...
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
  • Use C programming Make sure everything works well only upload Write a program that takes an...

    Use C programming Make sure everything works well only upload Write a program that takes an integer from standard input and prints all prime numbers that are smaller than it to standard output. Recall that a prime number is a natural number greater than 1 whose only positive divisors are 1 and itself. At the start of the program, prompt the user to input a number by printing "Input a number greater than 2:\n". If the user's input is less...

  • C++ Write a program that prompts the user to enter integers or a sentinel to stop....

    C++ Write a program that prompts the user to enter integers or a sentinel to stop. The program prints the highest and lowest numbers entered, the sum and the average. DO NOT USE ARRAYS, only variables and loops. Write a program the prompts the user to input a positive integer. Keep asking the user until a positive integer is entered. Once a positive integer is entered, print a message if the integer is prime or not. (NOTE: A number is...

  • C++ 4. Write a program that inputs 5 scores using a do while loop and asks...

    C++ 4. Write a program that inputs 5 scores using a do while loop and asks a user whether to continue or not ("yes" or "no il pressed you continues if pressed no' terutiinales) then calculates the average. 5. Make a program calculates sales for its division and quarterly earnings and show the total sum. Use 5 by 2 array matrix 6. This is an extra credil questioni Produce a program that displays by decreasing or decremeniting by 4 starting...

  • (Statistics) a. Write a C++ program that reads a list of double-precision scores from the keyboard...

    (Statistics) a. Write a C++ program that reads a list of double-precision scores from the keyboard into an array named scores. It is assumed that the user will enter no more than 35 scores. The scores are to be counted as they're read, and entry is to be terminated when a negative value has been entered. After all scores have been input, your program should find and display the sum and average of the scores. The scores should then be...

  • Implement a Java program using simple console input & output and logical control structures such that...

    Implement a Java program using simple console input & output and logical control structures such that the program prompts the user to enter 5 integer scores between 0 to 100 as inputs and does the following tasks For each input score, the program determines whether the corresponding score maps to a pass or a fail. If the input score is greater than or equal to 60, then it should print “Pass”, otherwise, it should print “Fail”. After the 5 integer...

  • In Java Programming: Create a flow chart for a program that prompts for an integer N...

    In Java Programming: Create a flow chart for a program that prompts for an integer N (number of students) and M (number of test scores for each students), and allows the user to N*M real numbers. The program then calculates the average for each student and class average. (1) Prompt the user to input N students and M test scores, then display the inputs. Enter number of students: You entered: 2 Enter number of test scores: You entered: 3 Enter...

  • convert pseducode to c++ Starting out with Programming Logic and Design (3) - Read-only Terates once...

    convert pseducode to c++ Starting out with Programming Logic and Design (3) - Read-only Terates once for each student. The nested inner loop, in lines 27 through 31, iterates once for each test score. Program 5-20 1 1 This program averages test scores. It asks the user for th 2 1/ number of students and the number of test scores per stude Declare Integer numStudents 4 Declare Integer numTest Scores 5 Declare Integer total 6 Declare Integer student 7 Declare...

  • C Programming For this task, you will have to write a program that will prompt the...

    C Programming For this task, you will have to write a program that will prompt the user for a number N. Then, you will have to prompt the user for N numbers, and print then print the sum of the numbers. For this task, you have to create and use a function with the following signature: int sum(int* arr, int n); Your code should look something like this (you can start with this as a template: int sum(int* arr, int...

  • program that does the following exactly once: int W e a complete C program that does...

    program that does the following exactly once: int W e a complete C program that does the • Uses a user validation loop to prompt its u that they have eaten in the last (30 days) (0; 250 ) • Computes and prints (to the screen th (which may have a fractional component). Hlut • Displays exactly one of the following - if the average number of pompt its user to enter the non-negative number of hamburgers ist (30 days)...

  • Create a C++ program to : Prompt user for seven test score Store the scores into...

    Create a C++ program to : Prompt user for seven test score Store the scores into an array Print the array before and after sorting Print the test average Convert the average to letter grade Search for a test score 90, using linear search Print, if test score 90 was found and at what position Add Comments SEPARATE THE FILES INTO 3 : header.h, functions.cpp, main.cpp

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
Active Questions
ADVERTISEMENT