Problem statement:- Program to enter basic salary and calculate the gross salary of an employee.
Data requirement:-
Data requirement:-
Input Data:- basic
Output Data:- gross
Additional Data:-da, hr, da_on_ta
Additional Data:-da, hr, da_on_ta
Program in C
Here is the source code of the C Program to enter basic salary and calculate the gross salary of an employee.
Code:
#include<stdio.h>
int main()
{
printf("Enter the basic salary of an employee:");
double basic;
scanf("%lf",&basic);
double da=(double)(15*basic)/100.0;
double hr=(double)(10*basic)/100.0;
double da_on_ta=(double)(3*basic)/100.0;
double gross=basic+da+hr+da_on_ta;
printf("Gross salary of an Employee= %0.2lf\n",gross);
}
int main()
{
printf("Enter the basic salary of an employee:");
double basic;
scanf("%lf",&basic);
double da=(double)(15*basic)/100.0;
double hr=(double)(10*basic)/100.0;
double da_on_ta=(double)(3*basic)/100.0;
double gross=basic+da+hr+da_on_ta;
printf("Gross salary of an Employee= %0.2lf\n",gross);
}
Input/Output:
Enter the basic salary of an employee:15000
Gross salary of an Employee= 19200.00
Program in C++
Here is the source code of the C++ Program to enter basic salary and calculate the gross salary of an employee.
Gross salary of an Employee= 19200.00
Program in C++
Here is the source code of the C++ Program to enter basic salary and calculate the gross salary of an employee.
Code:
#include<iostream>
using namespace std;
int main()
{
cout<<"Enter the basic salary of an employee:";
double basic;
cin>>basic;
double da=(double)(15*basic)/100.0;
double hr=(double)(10*basic)/100.0;
double da_on_ta=(double)(3*basic)/100.0;
double gross=basic+da+hr+da_on_ta;
cout<<"Gross salary of an Employee= "<<gross;
}
Input/Output:using namespace std;
int main()
{
cout<<"Enter the basic salary of an employee:";
double basic;
cin>>basic;
double da=(double)(15*basic)/100.0;
double hr=(double)(10*basic)/100.0;
double da_on_ta=(double)(3*basic)/100.0;
double gross=basic+da+hr+da_on_ta;
cout<<"Gross salary of an Employee= "<<gross;
}
Enter the basic salary of an employee:25000
Gross salary of an Employee= 32000
Program in Java
Gross salary of an Employee= 32000
Program in Java
Here is the source code of the Java Program to enter basic salary and calculate the gross salary of an employee.
Code:
import java.util.Scanner;
public class EmployeeGrossSalary {
public static void main(String[] args) {
Scanner cs=new Scanner(System.in);
System.out.println("Enter the basic salary of an employee:");
double basic=cs.nextDouble();
double da=(double)(15*basic)/100.0;
double hr=(double)(10*basic)/100.0;
double da_on_ta=(double)(3*basic)/100.0;
double gross=basic+da+hr+da_on_ta;
System.out.println("Gross salary of an Employee= "+gross);
cs.close();
}
}
Input/Output:public class EmployeeGrossSalary {
public static void main(String[] args) {
Scanner cs=new Scanner(System.in);
System.out.println("Enter the basic salary of an employee:");
double basic=cs.nextDouble();
double da=(double)(15*basic)/100.0;
double hr=(double)(10*basic)/100.0;
double da_on_ta=(double)(3*basic)/100.0;
double gross=basic+da+hr+da_on_ta;
System.out.println("Gross salary of an Employee= "+gross);
cs.close();
}
}
Enter the basic salary of an employee:
50475
Gross salary of an Employee= 64608.0
50475
Gross salary of an Employee= 64608.0
Program in Python
Here is the source code of the Python Program to enter basic salary and calculate the gross salary of an employee.
Code:
basic=float(input("Enter the basic salary of an employee:"))
da = (float)(15 * basic) / 100.0
hr = (float)(10 * basic) / 100.0
da_on_ta = (float)(3 * basic) / 100.0
gross = basic + da + hr + da_on_ta
print("Gross salary of an Employee= ",gross)
da = (float)(15 * basic) / 100.0
hr = (float)(10 * basic) / 100.0
da_on_ta = (float)(3 * basic) / 100.0
gross = basic + da + hr + da_on_ta
print("Gross salary of an Employee= ",gross)
Input/Output:
Enter the basic salary of an employee:10000
Gross salary of an Employee= 12800.0
Gross salary of an Employee= 12800.0
Most Recommend Questions:-
More Questions:-
0 Comments
Please do not Enter any spam link in the comment box