Hello coders, today we are going to solve Gross Salary CodeChef Solution whose Problem Code is FLOW011.

Problem
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 Solution 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 Solution 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); } } }
Disclaimer: The above Problem (Gross Salary) is generated by CodeChef but the solution is provided by Chase2learn.This tutorial is only for Educational and Learning purpose.