Turn in this program to the blackboard course website by the due date. Write a p
ID: 3847837 • Letter: T
Question
Turn in this program to the blackboard course website by the due date. Write a program to read a set of input test scores from the keyboard (floating point) and output to the screen the test score with the accompanying letter grade according to If the input test score is outside the range 0-100, output the test score with the message "Input test score %f is outside of the range 0- 100". Your program should loop to continue reading as many test scores from the keyboard that the user desires. Display an appropriate prompt for the user to input a new test score each time. Include comments at the top of your program describing its functionality.Explanation / Answer
The c programming code is
#include<stdio.h>
#include<conio.h>
int main()
{
char ch;
float score;
printf("enter y to continue to enter scores:");
//if you enter any other character it doesnt starts
scanf("%c",&ch);
while(ch=='y')
{
printf(" enter the test score:");
scanf("%f",&score);
if(score>=90&&score<=100)
{
printf("your grade is A");
}
else if(score>=80&&score<=89)
{
printf("your grade is B");
}
else if(score>=70&&score<=79)
{
printf("your grade is C");
}
else if(score>=60&&score<=69)
{
printf("your grade is D");
}
else if(score<60)
{
printf("your grade is F");
}
else if(score>100)
{
printf("input test score %f is outside of the range 0-100",score);
}
}
}
The sample output is:
enter y to continue to enter scores:y
enter the test score:90
your grade is A
enter the test score:88.6
your grade is B
enter the test score:73.4
your grade is C
enter the test score:65
your grade is D
enter the test score:47
your grade is F
enter the test score:108
input test score 108.000000 is outside of the range 0-100
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.