sexta-feira, 26 de maio de 2017

URI PROBLEMA 1051 - Imposto de Renda SOLUÇÃO EM C

URI Online Judge | 1051

Imposto de Renda

Por Neilor Tonin, URI  Brasil
Timelimit: 1
Em um país imaginário denominado Lisarb, todos os habitantes ficam felizes em pagar seus impostos, pois sabem que nele não existem políticos corruptos e os recursos arrecadados são utilizados em benefício da população, sem qualquer desvio. A moeda deste país é o Rombus, cujo símbolo é o R$.
Leia um valor com duas casas decimais, equivalente ao salário de uma pessoa de Lisarb. Em seguida, calcule e mostre o valor que esta pessoa deve pagar de Imposto de Renda, segundo a tabela abaixo.

Lembre que, se o salário for R$ 3002.00, a taxa que incide é de 8% apenas sobre R$ 1000.00, pois a faixa de salário que fica de R$ 0.00 até R$ 2000.00 é isenta de Imposto de Renda. No exemplo fornecido (abaixo), a taxa é de 8% sobre R$ 1000.00 + 18% sobre R$ 2.00, o que resulta em R$ 80.36 no total. O valor deve ser impresso com duas casas decimais.

Entrada

A entrada contém apenas um valor de ponto flutuante, com duas casas decimais.

Saída

Imprima o texto "R$" seguido de um espaço e do valor total devido de Imposto de Renda, com duas casas após o ponto. Se o valor de entrada for menor ou igual a 2000, deverá ser impressa a mensagem "Isento".



URI Online Judge | 1051

Taxes

By Neilor Tonin, URI  Brasil
Timelimit: 1
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".


#include <stdio.h>

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

Nenhum comentário:

Postar um comentário

URI PROBLEMA 1133 - Resto da Divisão SOLUÇÃO EM C

URI Online Judge | 1133 Resto da Divisão Adaptado por Neilor Tonin, URI   Brasil Timelimit: 1 Escreva um programa que leia 2 valo...