# Gross Salary | CodeChef Solution

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

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 Format

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

## Output Format

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``````

## Solution – Gross Salary | CodeChef Solution

### C++

```#include <bits/stdc++.h>
using namespace std;

int main()
{
int t;
cin >> t;
while (t--)
{
float salary = 0, basic, hra, da;
cin >> basic;
if (basic < 1500)
{
hra = (0.1 * basic);
da = (0.90 * basic);
}
else
{
hra = 500;
da = (0.98 * basic);
}
salary += (basic + hra + da);
cout << fixed << setprecision(2) << salary << "\n";
}
return 0;
}```

### Python

```#Solution Provided by CodingBroz
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)```

### 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 Hacker Rank but the Solution is Provided by CodingBroz. This tutorial is only for Educational and Learning Purpose.