Notice
Recent Posts
Recent Comments
Link
«   2025/08   »
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31
Archives
Today
Total
관리 메뉴

코딩로그

[백준/BOJ/C++] 14182번 Tax 본문

YJ/C++

[백준/BOJ/C++] 14182번 Tax

Team DAON 2021. 12. 22. 09:27

[문제]

The amount of income tax imposed on any taxpayer depends on his/her income. For an income less than or equal to 1,000,000 Oshloobs, no tax is paid. For an income greater than 1,000,000 and less than or equal to 5,000,000 Oshloobs, the tax is 10% of the income. For an income over 5,000,000 Oshloobs, the tax is 20% of the income. You should write a program to calculate the net income of any given employee after the deducted tax.

[입력]

There are multiple lines in the input. Each line contains an employee’s income before the tax, which is a positive integer, a multiple of 1000, and not greater than 10,000,000. The input terminates with a line containing 0 which should not be processed.

[출력]

For each employee, output a line containing the net income after the deducted tax.

[Source Code]

#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;

int main() {
	while(true){
		int input;
		long long result;
		cin >> input;

		if(input == 0) break;
		
		if(input <= 1000000)
			result = input;
		else if(input <= 5000000)
			result = input * 0.9;
		else
			result =  input * 0.8;
		cout << result << "\n";
	}
}

[결과 화면]