Here is a simple program which finds the Gross and Net pay of an employ when the user enters his basic salary.
Logic : Here we divided the the employee into three categories according to his basic pay. The first category is getting the basic pay less than Rs.5000/-. Second category is having the basic between Rs.5000/- to Rs.10000/-, and the third is getting the basic more than Rs.10000/-. Basic idea here is to calculate the DA and TAX amount according to the category.
Finally it calculates the desired two as,
Gross = Basic + DA+ HRA and,
Net = Gross- ( PF + Tax ).
We can add categories as we want. Also one can change the step values. Hope one can make it clear for himself the algorithm for the program by going through the codes.
#include<stdio.h>
void main()
{
float basic, da, hra, tax, pf, gross, net;
char name[50];
clrscr();
printf(“nnt ENTER YOUR NAME…:”);
scanf(“%s”, &name);
printf(“nt ENTER THE BASIC SALARY…:”);
scanf(“%f”, &basic);
pf = 0.08 * basic;
if (basic < 5000)
{
da = 0.3 * basic;
hra = 0.08 * basic;
}
else if ((basic >= 5000) && (basic < 10000))
{
da = 0.4 * basic;
hra = 0.1 * basic;
}
else
{
da = 0.5 * basic;
hra = 0.2 * basic;
}
gross = basic + da + hra;
net = gross – tax + pf;
printf(“nnt THE GROSS SALARY IS…: %f”, gross);
printf(“nnt THE NET SALARY IS…: %f”, net);
getch();
}
Description :
This is the one stop educational site for all Electronic and Computer students. If you want to learn something new then we are here to help. We work on Microcontroller projects, Basic Electronics, Digital electronics, Computer projects and also in basic c/c++ programs.
#Home #Sitemap #Submit #Terms of Use
Copyright©2011 electrofriends.com All Rights Reserved
Contact:info@electrofriends.com | Powered by Dhyeya