[URI Online Judge] – 1051 – Taxes

In an imaginary country called Lisarb, all the people are very happy to pay their taxes because they know that doesn’t exist corrupt politicians and the taxes are used to benefit the population, without any misappropriation. The currency of this country is Rombus, whose symbol is R$.

Read a value with 2 digits after the decimal point, equivalent to the salary of a Lisarb inhabitant. Then print the due value that this person must pay of taxes, according to the table below.

Remember, if the salary is R$ 3,000.00 for example, the rate of 8% is only over R$ 1,000.00, because the salary from R$ 0.00 to R$ 2,000.00 is tax free. In the follow example, the total rate is 8% over R$ 1000.00 + 18% over R$ 2.00, resulting in R$ 80.36 at all. The answer must be printed with 2 digits after the decimal point.


The input contains only a float-point number, with 2 digits after the decimal point.


Print the message “R$” followed by a blank space and the total tax to be payed, with two digits after the decimal point. If the value is up to 2000, print the message “Isento”.

Sample Inputs Sample Outputs
3002.00 R$ 80.36
1701.12 Isento
4520.00 R$ 355.60


#include <cstdio>
int main(){
 float s;
 scanf("%f", &s);
 if (s <= 2000.0)
 else if (s <= 3000.0)
 printf("R$ %.2f\n", (s - 2000.0) * 0.08);
 else if (s <= 4500.0)
 printf("R$ %.2f\n", 1000.0 * 0.08 + (s - 3000.0) * 0.18);
 printf("R$ %.2f\n", 1000.0 * 0.08 + 1500.0 * 0.18 + (s - 4500.0) * 0.28);
 return 0;

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s