Question one hundred and twenty-six: promotion price

Source: Internet
Author: User

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;
}



 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.