URI Online Judge Solution 1051 Taxes - Solution in C, C++, Java, Python and C# - Online Judge Solution

Latest

It is a free Online judges problems solution list. Here you can find UVA online Judge Solution, URI Online Judge Solution, Code Marshal Online Judge Solution, Spoz Online Judge Problems Solution

Thursday, July 13, 2017

URI Online Judge Solution 1051 Taxes - Solution in C, C++, Java, Python and C#

URI Online Judge Solution 1051 Taxes - Solution in C, C++, Java, Python and C#

URI Online Judge Solution 1051 Taxes  | Beginner
URI Problem Link - https://www.urionlinejudge.com.br/judge/en/problems/view/1051

Problem Name: 1051 Taxes Code




Problem Number : URI - 1051 Taxes Solution
Online Judge : URI Online Judge Solution
Category: Beginner
Solution Language : C,C plus plus, java, python, c#(c sharp)

URI Online Judge Solution 1051 Taxes - Solution in C, C++, Java, Python and C#


URI 1051 Taxes  Code in C / URI 1051 solution in C:

#include <stdio.h>
int main()
{
 float n, r, f1, f2, f3;
 scanf("%f", &n);

 if(n <= 2000){
  printf("Isento\n");
 }else{
  if(n > 2000 && n <= 3000){
   f1 = n - 2000;
   f1 = ((f1 * 8) / 100);
   r = f1;
  }else if(n > 3000 && n <= 4500){
   f1 = n - 2000;
   f2 = f1 - 1000;
   f1 -= f2;
   f1 = ((f1 * 8) / 100);
   f2 = ((f2 * 18) / 100);
   r = f2 + f1;
  }else{
   f1 = n - 2000;
   f2 = f1 - 1000;
   f3 = f2 - 1500;
   f1 -= f2;
   f2 -= f3;
   f1 = ((f1 * 8) / 100);
   f2 = ((f2 * 18) / 100);
   f3 = ((f3 * 28) / 100);
   r = f3 + f2 + f1;
  }

  printf("R$ %.2f\n", r);
 }

 return 0;
}


URI 1051 Taxes  Code in C++ / URI 1051 solution in CPP:

#include <iostream>
#include <iomanip>
using namespace std;

int main()
{
 float n, r, f1, f2, f3;
 cin >> n;

 if(n <= 2000){
  cout << "Isento" << endl;
 }else{
  if(n > 2000 && n <= 3000){
   f1 = n - 2000;
   f1 = ((f1 * 8) / 100);
   r = f1;
  }else if(n > 3000 && n <= 4500){
   f1 = n - 2000;
   f2 = f1 - 1000;
   f1 -= f2;
   f1 = ((f1 * 8) / 100);
   f2 = ((f2 * 18) / 100);
   r = f2 + f1;
  }else{
   f1 = n - 2000;
   f2 = f1 - 1000;
   f3 = f2 - 1500;
   f1 -= f2;
   f2 -= f3;
   f1 = ((f1 * 8) / 100);
   f2 = ((f2 * 18) / 100);
   f3 = ((f3 * 28) / 100);
   r = f3 + f2 + f1;
  }

  cout << "R$ " << fixed << setprecision(2) << r << endl;
 }

 return 0;
}


URI 1051 Taxes  Code in java/ URI 1051 solution in Java:

import java.io.IOException;
import java.util.Scanner;

public class Main {
 
    public static void main(String[] args) throws IOException {
 
        float n, r, f1, f2, f3;
  Scanner sc =new Scanner(System.in);
  n = sc.nextFloat();
  
 if(n <= 2000){
   System.out.print("Isento\n");
  }else{
   if(n > 2000 && n <= 3000){
    f1 = n - 2000;
    f1 = ((f1 * 8) / 100);
    r = f1;
   }else if(n > 3000 && n <= 4500){
    f1 = n - 2000;
    f2 = f1 - 1000;
    f1 -= f2;
    f1 = ((f1 * 8) / 100);
    f2 = ((f2 * 18) / 100);
    r = f2 + f1;
   }else{
    f1 = n - 2000;
    f2 = f1 - 1000;
    f3 = f2 - 1500;
    f1 -= f2;
    f2 -= f3;
    f1 = ((f1 * 8) / 100);
    f2 = ((f2 * 18) / 100);
    f3 = ((f3 * 28) / 100);
    r = f3 + f2 + f1;
   }
   System.out.printf("R$ %.2f\n",r);
  }
 
    }
 
}


URI 1051 Taxes  Code in Python / URI 1051 solution in Python:

salario = float(raw_input())

if(salario > 0 and salario <= 2000):
 print "Isento"
elif(salario > 2000 and salario <= 3000):
 resto = salario - 2000
 resultado = resto * 0.08
 print "R$ %.2f" %resultado
elif(salario > 3000 and salario < 4500):
 resto = salario - 3000
 resultado = (resto * 0.18) + (1000 * 0.08)
 print "R$ %.2f" %resultado
else:
 resto = salario - 4500
 resultado = (resto * 0.28) + (1500 * 0.18) + (1000 * 0.08)
 print "R$ %.2f" %resultado


URI Solution 1051 Taxes  Code / URI 1051 solution in  C# (C Sharp):




Demonstration:

Just implement this in coding. Since having any problem just put a comment below. Thanks



Tags: URI Online Judge Solution, URI OJ Solution list, URI Problems Solution, URI solver, URI all problem solution list, URI 1051 Taxes  code in C, URI 1051 code in C++, URI 1051 Taxes solution in C, URI solution, URI 1051 Taxes  solution in C,URI 1051 solution in C++-CPP, URI 1051 solution in C# (C sharp),URI 1051 solution in Java,URI 1051 solution in Python, URI 1051problem solution in all language, URI 1051 problem easy solution, URI Taxes solution

No comments:

Post a Comment