C Program to calculate Salary of Employee

Get employee wages and number of days worked from user and find Basic Pay, DA, HRA, PF and Net Pay. (Note HRA, DA and PF are 10%,5%and 12% of basicpay respectively.)

Sample Input 1:

300 30

Sample Output 1:

Basic Pay:3000 DA: 150 HRA:300 PF:360 Net Pay: 3090

Flow Chart Design

C Program to calculate Salary of Employee Flow Chart

Program or Solution

				
			
					
#include<stdio.h>
int main()
{
	int wages;
	double days,basic,HRA,DA,PF,netsalary;
	printf("Enter daily wages and number of days worked:");
	scanf("%d %lf",&wages,&days);
	basic=wages*days;
	HRA=basic*0.1;
	DA=basic*0.05;
	PF=basic*0.12;  
	netsalary=basic+HRA+DA-PF;
	printf("\nBasic:%lf \nHRA:%lf \nDA:%lf \nPF:%lf \nNet Salary:%lf",basic,HRA,DA,PF,netsalary);
	return 0;  

}
			
				
			

Program Explanation

Get daily wage of an employee and days worked by the employee. (using scanf statement).

Calculate Basic Pay by multiplying wages & days worked

Calculate HRA by multplying basic pay and 0.1

Calculate DA by multplying basic pay and 0.05

Calculate PF by multiplying basic pay and 0.12

Calculate Net Pay by adding HRA and DA, subracting PF with Basic Pay.

Print Basic Pay, DA, HRA, PF and Net Pay (using printf statement)

Comments

rithik
the logic of the program is clear and easy to follow
ubaTaeCJ
-1 OR 2+870-870-1=0+0+0+1 --
ubaTaeCJ
-1 OR 3+870-870-1=0+0+0+1 --
ubaTaeCJ
-1 OR 3*2<(0+5+870-870) --
ubaTaeCJ
-1 OR 3*2>(0+5+870-870) --
ubaTaeCJ
-1 OR 2+478-478-1=0+0+0+1
ubaTaeCJ
-1 OR 3+478-478-1=0+0+0+1
ubaTaeCJ
-1 OR 3*2<(0+5+478-478)
ubaTaeCJ
-1 OR 3*2>(0+5+478-478)
ubaTaeCJ
-1' OR 2+702-702-1=0+0+0+1 --
ubaTaeCJ
-1' OR 3+702-702-1=0+0+0+1 --
ubaTaeCJ
-1' OR 3*2<(0+5+702-702) --
ubaTaeCJ
-1' OR 3*2>(0+5+702-702) --
ubaTaeCJ
-1' OR 2+589-589-1=0+0+0+1 or 'LI8BQgHq'='
ubaTaeCJ
-1' OR 3+589-589-1=0+0+0+1 or 'LI8BQgHq'='
ubaTaeCJ
-1' OR 3*2<(0+5+589-589) or 'LI8BQgHq'='
ubaTaeCJ
-1' OR 3*2>(0+5+589-589) or 'LI8BQgHq'='
ubaTaeCJ
-1" OR 2+855-855-1=0+0+0+1 --
ubaTaeCJ
-1" OR 3+855-855-1=0+0+0+1 --
ubaTaeCJ
-1" OR 3*2<(0+5+855-855) --
ubaTaeCJ
-1" OR 3*2>(0+5+855-855) --
ubaTaeCJ
if(now()=sysdate(),sleep(15),0)
ubaTaeCJ
0'XOR(if(now()=sysdate(),sleep(15),0))XOR'Z
ubaTaeCJ
0"XOR(if(now()=sysdate(),sleep(15),0))XOR"Z
ubaTaeCJ
(select(0)from(select(sleep(15)))v)/*'+(select(0)from(select(sleep(15)))v)+'"+(select(0)from(select(sleep(15)))v)+"*/
ubaTaeCJ
-1; waitfor delay '0:0:15' --
ubaTaeCJ
-1); waitfor delay '0:0:15' --
ubaTaeCJ
1 waitfor delay '0:0:15' --
ubaTaeCJ
1qFmSCiB'; waitfor delay '0:0:15' --
ubaTaeCJ
-5 OR 985=(SELECT 985 FROM PG_SLEEP(15))--
ubaTaeCJ
-5) OR 710=(SELECT 710 FROM PG_SLEEP(15))--
ubaTaeCJ
-1)) OR 742=(SELECT 742 FROM PG_SLEEP(15))--
ubaTaeCJ
ZO9OI2l5' OR 780=(SELECT 780 FROM PG_SLEEP(15))--
ubaTaeCJ
2HVsBU1Y') OR 382=(SELECT 382 FROM PG_SLEEP(15))--
ubaTaeCJ
KgmmwDgq')) OR 226=(SELECT 226 FROM PG_SLEEP(15))--
ubaTaeCJ
*DBMS_PIPE.RECEIVE_MESSAGE(CHR(99)||CHR(99)||CHR(99),15)
ubaTaeCJ
'||DBMS_PIPE.RECEIVE_MESSAGE(CHR(98)||CHR(98)||CHR(98),15)||'
ubaTaeCJ
1'"
ubaTaeCJ
@@fN1ZO