2919 - 征收税金

通过次数

0

提交次数

0

时间限制 : 1 秒 内存限制 : 128 MB

对一批货物征收税金。价格在1万元及以上的货物征税5%,在5000元及以上、1万元以下的货物征税3%,在1000元及以上、5000元以下的货物征税2%,1000元以下的货物免税。编写一程序,读入货物价格,计算并输出税金。

题目输入

一行:一个实数,表示货物价格

题目输出

一行:一个实数,表示税金,小数保留两位。

输入/输出样例

输入格式

2000

输出格式

40.00

C++解答

#include<iostream>
#include<stdio.h>
using namespace std;
int main()
{
	int a,b,c,d,e,f,g,h,i;
	scanf("%d",&a);
	while(a>=10000)
	{
		cout<<a/95*2<<".00"<<endl;
		return 0;
	}
	while(a>=5000)
	{
		cout<<a/97*2<<".00"<<endl;
		return 0;
	}
	while(a>=1000)
	{
		cout<<a/98*2<<".00"<<endl;
		return 0;
	}
	
}