---
# System prepended metadata

title: 9-1 分數等第
tags: [DICE C]

---

---
tags: DICE C
---

9-1 分數等第
===

> [name=CHAWTeam]

目錄：[DICE C語言程式破解](https://hackmd.io/@CHAWTeam/DiceC)

題目
---

```!
寫一個程式讓使用者輸入分數，印出分數等級。
如100到90之間是等級 A，其餘分數與等級關係如下：
89-80 B
79-70 C
69-60 D
59-0 F
請輸出「Your score is （分數） and degree is （等第）!」

因為此題輸出有多種狀況，故需將程式碼複製3次，都判斷正確才給分，每個輸出都要換行。

以下提供 2 種範例參考，你的輸出只會是其中一種：

輸入範例1:
85

輸出範例1:
Your score is 85 and degree is B!

輸入範例2:
60

輸出範例2:
Your score is 60 and degree is D!

範例程式:
#include <stdio.h>
int main(){
int x;
scanf("%d",&x);
if (.....){printf(...);}
else if (.....){printf(...);}
else if (......){printf(...);}
else if (......){printf(...);}
else{printf(...);}
return 0;
}
```

程式碼
---

```c=
#include <stdio.h>

int main()
{
    int x;
    
    scanf("%d", &x);
    if (x >= 90)
        printf("Your score is %d and degree is A!\n", x);
    else if (x >= 80)
        printf("Your score is %d and degree is B!\n", x);
    else if (x >= 70)
        printf("Your score is %d and degree is C!\n", x);
    else if (x >= 60)
        printf("Your score is %d and degree is D!\n", x);
    else
        printf("Your score is %d and degree is F!\n", x);
    
    return 0;
}
```

輸出
---

```!
85
Your score is 85 and degree is B!
60
Your score is 60 and degree is D!
85
Your score is 85 and degree is B!
```

---

[查看我們在HackMD上的所有筆記](https://hackmd.io/@CHAWTeam)
目錄：[DICE C語言程式破解](https://hackmd.io/@CHAWTeam/DiceC)

---

{%hackmd Iiu5mOixR7yWkPHKCkabBg %}
<iframe class="LikeCoin" height="235" src="https://button.like.co/in/embed/chawteam/button?referrer=https://hackmd.io/@CHAWTeam/DiceC-9-1" width="100%"></iframe>

---

{%hackmd i1nMRrZcTFmTvoF897K9zg %}