Program to Define a Grade
This program is to define a Grade depending on the number given by the user.
00-32 = F Grade
33-40 = D Grade
41-50 = C Grade
52-59 = B Grade
60-69 = A- Grade
70-79 = A Grade
80-100 = A+ Grade
The Codes are given below for the program...
void main()
{
float num;
printf("Enter the Number You've Obtained: ");
scanf("%f",&num);
if(num>100||num<0)
{
printf("You have entered an invalid number, Enter a valid number!");
scanf("%f",&num);
}
else if(num>=80&&num<=100)
printf("You've obtained A+ Grade");
else if(num>=70&&num<80)
printf("You've obtained A Grade");
else if(num>=60&&num<70)
printf("You've obtained A- Grade");
else if(num>=50&&num<60)
printf("You've obtained B Grade");
else if(num>40&&num<50)
printf("You've obtained C Grade");
else if(num>=33&&num<=40)
printf("You've obtained D Grade");
else
printf("You've obtained F Grade");
}
No comments:
Post a Comment