| DANNY123 (23) | |
|
#include(stdio.h) main() { int score; char grade; printf("please input a score\n"); scanf("%d",&score); grade=score>=90?'A'score>=60?'B':'C'); printf("%d belongs to %c",score,grade); } Q,E,D I don't know which row is wrong, please help and I am novice. | |
|
|
|
| AbstractionAnon (517) | |||
#include must use <> or "".
There are a couple of problems with line 8: - You have an unbalanced parenthises. - You're missing the colon in the first ternary opeator It should be: grade=score>=90?'A' : (score>=60?'B':'C');PLEASE USE CODE TAGS (the <> formatting button) when posting code. | |||
|
|
|||
| DANNY123 (23) | |
| Ops, sorry. And the problem is denote a number as A,B,C. Greater than 90, A. And less than 60, B and C. | |
|
|
|
| Chervil (1206) | |
The first line is wrong. should be #include <stdio.h> The conditional statement requires brackets, like this: (score>=90) | |
|
|
|