How can I write this program using switch cases?
#include <stdio.h>
int main()
{
int marks;
char grade;
printf(“Enter your marks: “);
scanf(“%d”, &marks);
if(marks > 100)
{
printf(“Wrong Input”);
}
else
{
if(marks >= 75)
{
grade = ‘A’;
}
else if(marks >= 65)
{
grade = ‘B’;
}
else if(marks >= 55)
{
grade = ‘C’;
}
else if(marks >= 45)
{
grade = ‘S’;
}
else
{
grade = ‘F’;
}
printf(“Your grade is %c”, grade);
}
return 0;
}
Check this out – https://tutorial.techaltum.com/c-program-to-find-grade-of-a-student.html