daily pastebin goal
15%
SHARE
TWEET

URI - 1051 - Taxes

a guest Feb 19th, 2019 97 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main(){
  5.     double sal;
  6.     cin >> sal;
  7.     double totalTax = 0.0;
  8.     double newSal = 0.0;
  9.     double tempSal = 0.0;
  10.     double raise = 0.0;
  11.     if(sal > 2000.00){
  12.         if(sal >= 4500.01){
  13.             newSal = (sal - 4500.00);
  14.             raise = 28.00;
  15.             tempSal = (newSal*raise)/100.00;
  16.             totalTax += tempSal;
  17.             sal = (sal - newSal);
  18.         }
  19.         if(sal >= 3000.01 && sal <= 4500.00){
  20.             newSal = (sal - 3000.00);
  21.             raise = 18.00;
  22.             tempSal = (newSal*raise)/100.00;
  23.             totalTax += tempSal;
  24.             sal = (sal - newSal);
  25.         }
  26.         if(sal >= 2000.01 && sal <= 3000.00){
  27.             newSal = (sal - 2000.00);
  28.             raise = 8.00;
  29.             tempSal = (newSal*raise)/100.00;
  30.             totalTax += tempSal;
  31.             sal = (sal - newSal);
  32.         }
  33.     }
  34.     if(totalTax == 0.0){
  35.         printf("Isento\n");
  36.     }else{
  37.         printf("R$ %0.2lf\n", totalTax);
  38.     }
  39.     return 0;
  40. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top