Digital जीवन

Free Online Education for India...

Full width home advertisement

Computer Basic

C Programming

Engineering Graphics

Post Page Advertisement [Top]

Dr. A.P.J. Abdul Kalam Technical University, Lucknow

KCS151 / KCS251 Programming for Problem Solving - Using C Language


Lab Exercises


2. Basic salary of an employee is input through the keyboard. The DA is 25% of the basic salary while the HRA is 15% of the basic salary. Provident Fund is deducted at the rate of 10% of the gross salary (BS+DA+HRA).
Program to calculate the Net Salary.


/*
 File: Prgrm02.c
 Author: Aditya Saini
 Date: Jan 15, 2021
 Description: Basic salary of an employee is input through the keyboard.
 The DA is 25% of the basic salary while the HRA is 15% of the basic salary.
 Provident Fund is deducted at the rate of 10% of the gross salary (BS+DA+HRA).
 Program to calculate the Net Salary.
*/

#include <stdio.h>

int main (void)
{
     float basic_salary;
     float DA;
     float HRA;
     float PF;
     float gross_salary;
     float net_salary;

     //Input basic salary
     printf("Input Basic Salary: ");
     scanf("%f", &basic_salary);

     //Calculate DA
     DA = basic_salary * 25.0 / 100.0;

     //Calculate HRA
     HRA = basic_salary * 15.0 / 100.0;

     //Calculate gross salary
     gross_salary = basic_salary + DA + HRA;

     //Calculate PF
     PF = gross_salary * 10.0 / 100.0;

     //Calculate net salary
     net_salary = gross_salary - PF;

     //Print result
     printf("Basic Salary: %.2f\n", basic_salary);
     printf("DA: %.2f\n", DA);
     printf("HRA: %.2f\n", HRA);
     printf("Gross Salary: %.2f\n", gross_salary);
     printf("PF: %.2f\n", PF);
     printf("Net Salary: %.2f", net_salary);

     return 0;
}

Output

Input Basic Salary: 10000
Basic Salary: 10000.00
DA: 2500.00
HRA: 1500.00
Gross Salary: 14000.00
PF: 1400.00
Net Salary: 12600.00



No comments:

Post a Comment

Please do not post spam links.

Bottom Ad [Post Page]

| Designed by Colorlib