Infotech(Infotpark)provides you information about all the latest and current trends in computer world.
.........
So stay tuned........
Tuesday, 29 May 2012
Monday, 21 May 2012
C-PROGRAM TO PRINT THE SALARY SHEET
#include<stdio.h>
#include<conio.h>
struct employ
{
char
name[20];
int
id,bp;
float
tot,hra,dr;
};
void main()
{
struct
employ list[20],temp;
char
name[30];
int
n,i,j,m;
clrscr();
printf("Enter
the number of employees: ");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("\nEnter
the name of employee: ");
scanf("%s",list[i].name);
printf("\nEnter
id number: ");
scanf("%d",&list[i].id);
printf("\nEnter
the basic pay: ");
scanf("%d",&list[i].bp);
list[i].dr=.2*list[i].bp;
list[i].hra=.6*list[i].bp;
list[i].tot=list[i].dr
+list[i].hra+list[i].bp;
}
for(i=0;i<n;i++)
{
for(j=0;j<n-i-1;j++)
{
if(strcmp(list[j].name,list[j+1].name)>0)
{
temp=list[j];
list[j]=list[j+1];
list[j+1]=temp;
}
}
}
printf("Salary
Sheet is\n");
printf("NAME ID NO
BASIC PAY SALARY\n\n");
for(i=0;i<n;i++)
printf("%s\t%d\t%d\t%f\n",list[i].name,list[i].id,list[i].bp,list[i].tot);
getch();
}
/* OutPut
---------
Enter the number of employees:2
Enter the name of employee: manu
Enter id number: 101
Enter the basic pay: 4000
Enter the name of employee: mani
Enter id number: 201
Enter the basic pay: 6000
Salary Sheet is
NAME ID NO BASIC PAY
SALARY
mani 201 6000
10800.000
manu 101 4000
7200.000
Subscribe to:
Posts (Atom)