URI 1051 - Taxes Solution in C,C++,Python | URI Online Judge Solution 1051 - Taxes

URI 1051 - Taxes Solution in C,C++,Python | URI Online Judge Solution 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,002.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.

Input

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

Output

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".

Input SamplesOutputs Samples

3002.00

R$ 80.36

1701.12

Isento

4520.00

R$ 355.60

URI Online Judge Solution 1051 - Taxes | URI 1051 Solution in C,C++,Python :

                                        Demonstration:


It's a not a hard problem.You just have to check the conditions by using if-else  to find the combination of the table given.Then you have to print those values according to the problem's statement.
Percentages:

A percentage is a fraction whose denominator (bottom) is 100.

So if we say 50%, we mean 50/100 = 1/2 (after cancelling). 

So 50% means ½. If want to find 10% of something, 'of' just means 'times'. 

So 10% of 150 = 10/100 × 150 = 15.

If you have to turn a percentage into a decimal, just divide by 100.

For example, 25% = 25/100 = 0.25. 

To change a decimal into a percentage, multiply by 100. So 0.3 = 0.3 × 100 =30% .

Example:

Find 25% of 10 (remember 'of' means 'times').

25/100 × 10

= 2.5

N.B: Don't copy paste the code as same. Just try to understand it and try yourself. It would be better for you.


  URI Problem 1051 Solution in C :   

  URI Online Judge 1051 Solve  in C :                                                                             
#include <stdio.h>

int main(){
    double sal;
    scanf("%lf", &sal);
    
    if(sal <= 2000.00){
        printf("Isento\n");
    }else if (sal >= 2000.01 && sal <= 3000.00){
          printf("R$ %.2f\n", (sal - 2000.00)*0.08);
    }else if (sal >= 3000.01 && sal <= 4500.00){
          printf("R$ %.2f\n", ((sal - 3000.00)*0.18 + 1000.00*0.08));
    }else if (sal >= 4500.01){
          printf("R$ %.2f\n", ((sal - 4500.00)*0.28 + 1500.00*0.18 + 1000.00*0.08));
    }
    return 0;
}

0 Response to URI 1051 - Taxes Solution in C,C++,Python | URI Online Judge Solution 1051 - Taxes

Post a Comment