Gross Salary Codechef Solution

Hello Programmers In this post, you will know how to solve the Gross Salary CodeChef Solution. The Problem Code is FLOW011.

Gross Salary Codechef Solution
Gross Salary Codechef Solution

One more thing to add, don’t directly look for the solutions, first try to solve the problems of Codechef by yourself. If you find any difficulty after trying several times, then you can look for solutions.

Ezoicreport this adProblem

In a company an emplopyee is paid as under: If his basic salary is less than Rs. 1500, then HRA = 10% of base salary and DA = 90% of basic salary.

If his salary is either equal to or above Rs. 1500, then HRA = Rs. 500 and DA = 98% of basic salary. If the Employee’s salary is input, write a program to find his gross salary.

NOTE: Gross Salary = Basic Salary + HRA + DA

Input 

The first line contains an integer T, total number of testcases. Then follow T lines, each line contains an integer salary.

Output

For each test case, output the gross salary of the employee in a new line. Your answer will be considered correct if the absolute error is less than 10^-2.

Constraints

  • 1 ≤ T ≤ 1000
  • 1 ≤ salary ≤ 100000

Example

Sample Input 

3
1203
10042
1312

Sample Output 

2406.00
20383.16
2624

Gross Salary CodeChef Solution in Python

T = int(input())
for i in range(T):
    n = int(input())
    if n < 1500:
        salary = n + (90*n/100) + (10*n/100)
        print(salary)
    else:
        salary = n + (98*n/100) + 500
        print(salary)

Gross Salary CodeChef Solutions in CPP

#include <stdio.h>
int main(){
	int a;
	scanf("%d",&a);
	while(a--){
		long b;
		float d;
		scanf("%li",&b);
		if(b<1500)
			printf("%g\n",b+0.1*b+0.9*b);
		else{
			printf("%g\n",b+500+b*0.98);
		}
	}
}

Gross Salary CodeChef Solutions in JAVA

import java.util.*;
class CodeChef
{
    public static void main(String args[]){
        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        for(int i=0;i<n;i++)
        {
            int a = s.nextInt();
            float sal;
            if(a<1500)
            {
                sal = (float)(a + (0.10*a)+(0.90*a));
            }
            else
            {
                sal = (float) (a+500+(0.98*a));
            }
            System.out.println(sal);
        }
    }
}
Ezoicreport this ad

Disclaimer: The above Problem (Gross Salary) is generated by CodeChef but the solution is provided by BrokenProgrammers. This tutorial is only for Educational and Learning purpose.

Note:- I compile all programs, if there is any case program is not working and showing an error please let me know in the comment section. If you are using adblocker, please disable adblocker because some functions of the site may not work correctly.

Next: The Smallest Pair Codechef Solution

Sharing Is Caring

Leave a Comment

Ezoicreport this ad