C Program to Calculate Gross Salary

  #include<stdio.h>
  int main()
  {
	float basic,da,hra,gross_salary;
	
	printf("Enter the basic salary :");
	scanf("%f",&basic);
	da=basic*40/100;
	hra=basic*20/100;
	gross_salary=basic+da+hra;
	printf("DA=%f\nHRA=%f\nGross salary=%f",da,hra,gross_salary);
	
	return 0;
  }

Output

	Enter the basic salary :3200
	DA=1280.000000
	HRA=640.000000
	Gross salary=5120.000000
Compile and Run Online