Algorithm


 

problem Link : https://www.codechef.com/problems/TAXES 

Problem

In Chefland, a tax of rupees 10 is deducted if the total income is strictly greater than rupees 100.

Given that total income is  rupees, find out how much money you get.

Input Format

  • The first line of input will contain a single integer , denoting the number of test cases.
  • The first and only line of each test case contains a single integer  — your total income.

Output Format

For each test case, output on a new line, the amount of money you get.

Constraints

  • 1≤�≤100
  • 1≤�≤1000

Sample 1:

Input
 
Output
 
4
5
105
101
100
5
95
91
100

Explanation:

Test case 1: Your total income is 5 rupees which is less than 100 rupees. Thus, no tax would be deducted and you get 5 rupees.

Test case 2: Your total income is 105 rupees which is greater than 100 rupees. Thus, a tax of 10 rupees would be deducted and you get 105−10=95 rupees.

Test case 3: Your total income is 101 rupees which is greater than 100 rupees. Thus, a tax of 10 rupees would be deducted and you get 101−10=91 rupees.

Test case 4: Your total income is 100 rupees which is equal to 100 rupees. Thus, no tax would be deducted and you get 100 rupees.

Code Examples

#1 Code Example with C Programming

Code - C Programming

#include<stdio.h>

int main(void) {
    int t,i;
    scanf("%d",&t);
    while(t--)
    {
        scanf("%d",&i);
        if(i>100) printf("%d\n",i-10);
        else printf("%d\n",i);
    }
	return 0;
} 
Copy The Code & Try With Live Editor

Input

x
+
cmd
4
5
105
101
100

Output

x
+
cmd
5
95
91
100
Advertisements

Demonstration


CodeChef solution TAXES  - Tax in Chefland CodeChef solution in C,C++

Previous
CodeChef solution IPLTRSH - IPL Ticket Rush Codechef solution in C,C++
Next
CodeChef solution TIMELY - Reach on Time Codechef solution in C,C++