1295
C language: Select structure 7 (score conversion)
Time limit (Common/Java): 1000 ms/3000 Ms running memory limit: 65536 Kbyte
Total submissions: 901 pass the test: 593
Description
The score is given in the one hundred score system. The score levels 'A', 'B', 'C', 'D', and 'E' must be output '. If the score is 90 or higher, it is a, 80-89 is B, 70-79 is C, 60-69 is d, and 60 is E.
Complete the following procedures.
# Include <stdio. h>
Int main ()
{
Int X;
While (scanf ("% d", & X )! = EOF)
{........................
.........................
}
Return 0;
}
Input
Contains multiple groups of data, each with an integer between 0 and.
Output
Each score corresponds to a letter, indicating the corresponding score level.
Sample Input
95
35
60
85
Sample output
A
E
D
B
Prompt
We recommend that you use the if statement format 1, the nested if Statement (if statement format 3), and the switch statement respectively.
Question Source
# Include <stdio. h>
Int main ()
{
Int X;
While (scanf ("% d", & X )! = EOF)
{If (x> = 90)
Printf ("A \ n ");
If (x> = 80 & x <90)
Printf ("B \ n ");
If (x> = 70 & x <80)
Printf ("C \ n ");
If (x> = 60 & x <70)
Printf ("d \ n ");
If (x <60)
Printf ("e \ n ");
}
Return 0;
}
# Include <stdio. h>
Int main ()
{
Int X;
While (scanf ("% d", & X )! = EOF)
{
If (x> = 90)
Printf ("A \ n ");
Else
If (x> = 80 & x <= 89)
Printf ("B \ n ");
Else
If (x> = 70 & x <= 79)
Printf ("C \ n ");
Else
If (x> = 60 & x <= 69)
Printf ("d \ n ");
Else
Printf ("e \ n ");
}
Return 0;
}
# Include <stdio. h>
Int main ()
{
Int X;
While (scanf ("% d", & X )! = EOF)
{If (x> = 90) printf ("A \ n ");
Else if (x> = 80) printf ("B \ n ");
Else if (x> = 70) printf ("C \ n ");
Else if (x> = 60) printf ("d \ n ");
Else printf ("e \ n ");
}
Return 0;
}
# Include <stdio. h>
Int main ()
{
Int X;
While (scanf ("% d", & X )! = EOF)
{
Switch (X/10)
{
Case 9:
Case 10: printf ("A \ n"); break;
Case 8: printf ("B \ n"); break;
Case 7: printf ("C \ n"); break;
Case 6: printf ("d \ n"); break;
Default: printf ("e \ n"); break;
}
}
Return 0;
}
# Include <stdio. h>
# Include <iostream. h>
Int main ()
{Int X;
While (scanf ("% d", & X )! = EOF)
{
Switch (X/10)
{Case 10:
Case 9: printf ("A \ n"); break;
Case 8: printf ("B \ n"); break;
Case 7: printf ("C \ n"); break;
Case 6: printf ("d \ n"); break;
Default: printf ("e \ n ");
}
}
// System ("pause ");
Return 0;
}
# Include <stdio. h>
Int main ()
{
Int X;
While (scanf ("% d", & X )! = EOF)
/*{
If (x> = 90 & x <= 100)
{
Printf ("A \ n ");
}
Else if (x> = 80 & x <90)
{
Printf ("B \ n ");
}
Else if (x> = 70 & x <80)
{
Printf ("C \ n ");
}
Else if (x> = 60 & x <70)
{
Printf ("d \ n ");
}
Else
{
Printf ("e \ n ");
}*/
Switch (X/10)
{
Case 0:
Case 1:
Case 2:
Case 3:
Case 4:
Case 5: printf ("e \ n"); break;
Case 6: printf ("d \ n"); break;
Case 7: printf ("C \ n"); break;
Case 8: printf ("B \ n"); break;
Case 9:
Case 10: printf ("A \ n"); break;
}
Return 0;
}
98
Score Conversion
Time Limit: 3000 MS | memory limit: 65535 KB
Difficulty: 1
Description
Enter a percentage system score m to convert it to the corresponding level. The specific conversion rules are as follows:
90 ~ 100 is;
80 ~ 89 is B;
70 ~ 79 is C;
60 ~ 69 is D;
0 ~ 59 is E;
Input
The first line is an integer N, indicating the number of groups of test data (n <10)
Each group of test data occupies one row and is composed of an integer m (0 <= m <= 100 ).
Output
Output a row of input data for each group.
Sample Input
2
97
80
Sample output
A
B
# Include <stdio. h>
Int main ()
{
Int N;
Scanf ("% d \ n", & N );
While (n --)
{Int X;
Scanf ("% d", & X );
If (x> = 90)
Printf ("A \ n ");
If (x> = 80 & x <90)
Printf ("B \ n ");
If (x> = 70 & x <80)
Printf ("C \ n ");
If (x> = 60 & x <70)
Printf ("d \ n ");
If (x <60)
Printf ("e \ n ");
}
}
******************************
**************************************** **********************
# Include <iostream>
Using namespace STD;
Int main ()
{
Int N, S;
Cin> N;
While (n --)
{
Cin> S;
Switch (S/10)
{
Case 10:
Case 9: cout <"A" <Endl; break;
Case 8: cout <"B" <Endl; break;
Case 7: cout <"C" <Endl; break;
Case 6: cout <"D" <Endl; break;
Default: cout <"E" <Endl; break;
}
}
}
*********************************
# Include <iostream>
Using namespace STD;
Int main ()
{
Int T,;
Cin> T;
While (t --)
{
Cin>;
Cout <(A <60? 'E': A <70? 'D': A <80? 'C': A <90? 'B': 'A') <Endl;
}
}
**************************************** **************************** 88
# Include <stdio. h>
Int main ()
{
Int score, M, N;
Scanf ("% d", & M );
While (M --)
{
Scanf ("% d", & score );
N = score/10;
Switch (N)
{
Case 10:
Case 9: printf ("A \ n"); break;
Case 8: printf ("B \ n"); break;
Case 7: printf ("C \ n"); break;
Case 6: printf ("d \ n"); break;
Case 5:
Case 4:
Case 3:
Case 2:
Case 1:
Case 0: printf ("e \ n"); break;
}
}
Return 0;
}
*********************************
**************************************** **
# Include <stdio. h>
Int main ()
{
Int N,;
Scanf ("% d \ n", & N );
While (n --){
Scanf ("% d \ n", & );
Switch (A/10)
{
Case 10: printf ("A \ n"); break;
Case 9: printf ("A \ n"); break;
Case 8: printf ("B \ n"); break;
Case 7: printf ("C \ n"); break;
Case 6: printf ("d \ n"); break;
Default: printf ("e \ n ");
}
}
}
**************************************** **
# Include <stdio. h>
Main ()
{
Int Z, X, C;
Char A [12] = {'E', 'E', 'D', 'C ', 'B', 'A', 'A '};
While (~ Scanf ("% d", & Z ))
{
While (Z --)
{
Scanf ("% d", & X );
If (X! = 0) x/= 10;
Else x = 0;
Printf ("% C \ n", a [x]);
}
}
}
***********************************
# Include <iostream>
Using namespace STD;
Int main ()
{
Int N;
Cin> N;
While (n --)
{
Int score;
Cin> score;
If (score> = 90 & score <= 100)
Cout <'A' <Endl;
Else if (score> = 80 & score <= 89)
Cout <'B' <Endl;
Else if (score> = 70 & score <= 79)
Cout <'C' <Endl;
Else if (score> = 60 & score <= 69)
Cout <'D' <Endl;
Else if (score <60 & score> = 0)
Cout <'E' <Endl;
Else
Return 0;
}
Return 0;
}
********************
# Include <stdio. h>
Int main ()
{
Int I, j, N;
Char SOC;
Scanf ("% d", & I );
For (j = 1; j <= I; j ++)
{
Scanf ("% d", & Soc );
If (SOC> = 90 & Soc <= 100)
Printf ("A \ n ");
If (SOC> = 80 & Soc <= 89)
Printf ("B \ n ");
If (SOC> = 70 & Soc <= 79)
Printf ("C \ n ");
If (SOC> = 60 & Soc <= 69)
Printf ("d \ n ");
If (SOC> = 0 & Soc <= 59)
Printf ("e \ n ");
}
Return 0;
}
********************************
88888888888888888888
* **************** 8
# Include <stdio. h>
Int main ()
{Int N, I, m;
Scanf ("% d", & N );
For (I = 1; I <= N; I ++)
{Scanf ("\ n % d", & M );
If (M> = 90) & (M <= 100) printf ("A \ n ");
If (M> = 80) & (M <= 89) printf ("B \ n ");
If (M> = 70) & (M <= 79) printf ("C \ n ");
If (M> = 70) & (M <= 69) printf ("d \ n ");
If (M> = 0) & (M <= 59) printf ("e \ n ");
}
Return 0;
}