Print? Description
A department store uses a discount method for sales promotion.
(1) If the price is 1000 yuan or higher, the discount is off;
(2) 2000 Yuan or more, off;
(3) If the price is 3000 yuan or higher, the discount is off;
(4) 5000 Yuan or more, off. Write a program, enter the number of shopping items, calculate and output the discount price.
Input
The first line has a positive integer t, indicating that there are t groups of data. In the following t rows, each line has a positive integer a, that is, the number of shopping items.
Output
A total of t rows, one number per row, that is, the corresponding preferential price, requires a decimal number.
Sample Input
2
2000
1550
Sample Output
1800.0
1472.5
Description
A department store uses a discount method for sales promotion.
(1) If the price is 1000 yuan or higher, the discount is off;
(2) 2000 Yuan or more, off;
(3) If the price is 3000 yuan or higher, the discount is off;
(4) 5000 Yuan or more, off. Write a program, enter the number of shopping items, calculate and output the discount price.
Input
The first line has a positive integer t, indicating that there are t groups of data. In the following t rows, each line has a positive integer a, that is, the number of shopping items.
Output
A total of t rows, one number per row, that is, the corresponding preferential price, requires a decimal number.
Sample Input
2
2000
1550
Sample Output
1800.0
1472.5
[Plain] # include <stdio. h>
Int main ()
{
Int t;
Int;
Double value;
Scanf ("% d", & t );
While (t --)
{
Scanf ("% d", & );
If (a> 0)
{
If (a> = 5000)
{
Value = a * 0.80;
}
Else if (a> = 3000)
{
Value = a * 0.85;
}
Else if (a> = 2000)
{
Value = a * 0.90;
}
Else if (a> = 1000)
{
Value = a * 0.95;
}
Else
{
Value =;
}
Printf ("% 0.1lf", value );
If (t> 0)
{
Printf ("\ n ");
}
}
}
Return 0;
}
# Include <stdio. h>
Int main ()
{
Int t;
Int;
Double value;
Scanf ("% d", & t );
While (t --)
{
Scanf ("% d", & );
If (a> 0)
{
If (a> = 5000)
{
Value = a * 0.80;
}
Else if (a> = 3000)
{
Value = a * 0.85;
}
Else if (a> = 2000)
{
Value = a * 0.90;
}
Else if (a> = 1000)
{
Value = a * 0.95;
}
Else
{
Value =;
}
Printf ("% 0.1lf", value );
If (t> 0)
{
Printf ("\ n ");
}
}
}
Return 0;
}