scanf("%d",&num);
if(num<0||num>100)printf("The number is wrong!");
else if(num<=59)printf("E");
else if(num<=69)printf("D");
else if(num<=79)printf("C");
else if(num<=89)printf("B");
else printf("A");
return 0;
}
Switch 语句
#include <stdio.h>
main()
{
int num,n;
printf("Input:");
scanf("%d",&num);
n=num/10;
switch(n)
{
case 0:
case 1:
case 2:
case 3:
case 4: