Problem 13

author
By Supreme2023-02-23
Problem Statement :
Write a c program to prepare pay slip using following data. Da = 10% of basic, Hra = 7.50% of basic, Ma = 300, Pf = 12.50% of basic, Gross = basic + Da + Hra + Ma, Nt = Gross – Pf.
Code:

#include <stdio.h>

int main()
{

// 13. Write a c program to prepare pay slip using following data.
// Da = 10% of basic, Hra = 7.50% of basic, Ma = 300,
// Pf = 12.50% of basic, Gross = basic + Da + Hra + Ma, Nt = Gross - Pf

printf("===============================");
printf("\n\tPay Slip");
printf("\n===============================\n\n");

float basic, Da, Hra, Ma, Pf, Gross;

printf("Enter Basic Amount : ");
scanf("%f", &basic);

Da = basic * .1;
Hra = basic * .075;
Ma = 300;
Pf = basic * .125;
Gross = basic + Da + Hra + Ma;

printf("\n_____________________________\n");
printf("\n Basic = %.2f", basic);
printf("\n Da = %.2f", Da);
printf("\n Hra = %.2f", Hra);
printf("\n Ma = %.2f", Ma);
printf("\n Pf = %.2f", Pf);
printf("\n Gross = %.2f", Gross);
printf("\n Nt = %.2f", Gross - Pf);
printf("\n_____________________________\n\n");

return 0;
}

Description :
  • This program is for preparing a pay slip with some given calculations. It asks the user to enter the basic amount, calculates the Dearness Allowance (Da) at 10% of basic, House Rent Allowance (Hra) at 7.5% of basic, Medical Allowance (Ma) as 300, Provident Fund (Pf) at 12.5% of basic, Gross as the sum of basic, Da, Hra, and Ma, and Net Salary (Nt) as Gross - Pf. Finally, it prints all the calculated values in a formatted way.
Output Image:
Output-image

© Copyright 2022. All right reserved, GTU Coder.