* if code is S, then print SUPER *
* if code is A, then print VERY GOOD *
* if code is B, then print FAIR *
* if code is Y, then print ABSENT *
* if code is F, then print FAILS */
#include <stdio.h>
#include <ctype.h>
#include <string.h>
void main()
{
char remark[15];
char grade;
printf(“Enter the grade\n”);
scanf(“%c”,&grade);
grade=toupper(grade); /* lower case letter to upper case */
switch(grade)
{
case ‘S’: strcpy(remark,” SUPER”);
break;
case ‘A’: strcpy(remark,” VERY GOOD”);
break;
case ‘B’: strcpy(remark,” FAIR”);
break;
case ‘Y’: strcpy(remark,” ABSENT”);
break;
case ‘F’: strcpy(remark,” FAILS”);
break;
default : strcpy(remark, “ERROR IN GRADE\n”);
break;
} /* End of switch */
printf(“RESULT : %s\n”,remark);
} /* End of main() */
/*——————————————-
Output
RUN 1
Enter the grade
s
RESULT : SUPER
RUN 2
Enter the grade
y
RESULT : ABSENT
———————————————–*/
Not Satisfied ? Just search & get the result
Related posts:
- C program to accept a figure code and find the ares of different geometrical figures such as circle, square, rectangle etc using switch
- C program to simulate a simple calculator to perform arithmetic operations like addition, subtraction,multiplication and division only on integers
- C program to read N names, store them in the form of an array and sort them in alphabetical order. Output the give names and the sorted names in two columns side by side with suitable heading
- C Program to accept two matrices and check if they are equal
- C program to accept a string and a substring and check if the substring is present in the given string
