我感覺用if else語句來寫這個輸出會更簡單
#include <stdio.h>
int main()?
{
? ? int score = 87;
? ? if (score>=90)
? ? {
? ? ? ? printf("等級A");
? ? }
? ? else if (score>=80)
? ? {
? ? ? ? printf("等級B");? ??
? ? }
? ? else if (score>=60)
? ? {
? ? ? ? printf("等級C");? ? ?
? ? }
? ? else
? ? {
? ? ? ? printf("等級D");? ??
? ? }
? ? return 0;
}
2020-04-17
你這個是不是少了這個字符“&”如果是90那是哪個等級,下面都滿足啊。