#include<stdio.h>#include<string.h>int main(){char b[100];scanf("%s",b);int a;scanf("%d",&a);printf("%s\n",b);printf("%d\n",a);if(a>=90&&a<100){printf("S Grade\n");}else if(a>=80&&a<90){printf("A Grade\n");}else if(a>=70&&a<80){printf("B Grade\n");}else if(a>=60&&a<70){printf("C Grade\n");}else if(a>=55&&a<60){printf("D Grade\n");}else if(a>=50&&a<55){printf("E Grade\n");}else if(a<50){printf("F Grade\n");}return 0;}
Question
#include<stdio.h>#include<string.h>int main(){char b[100];scanf("%s",b);int a;scanf("%d",&a);printf("%s\n",b);printf("%d\n",a);if(a>=90&&a<100){printf("S Grade\n");}else if(a>=80&&a<90){printf("A Grade\n");}else if(a>=70&&a<80){printf("B Grade\n");}else if(a>=60&&a<70){printf("C Grade\n");}else if(a>=55&&a<60){printf("D Grade\n");}else if(a>=50&&a<55){printf("E Grade\n");}else if(a<50){printf("F Grade\n");}return 0;}
Solution
This is a C program that takes a string and an integer as input. The string is printed as it is. The integer is assumed to be a score out of 100. Depending on the range in which the score falls, a grade is assigned and printed. The grading scheme is as follows:
- 90 to 100: S Grade
- 80 to 89: A Grade
- 70 to 79: B Grade
- 60 to 69: C Grade
- 55 to 59: D Grade
- 50 to 54: E Grade
- Less than 50: F Grade
The program ends after printing the grade.
Similar Questions
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.