Create a structure of pay roll to Count the salary of 10 employees including basic salary - C - A6P2



/* Write a program to create a structure of pay roll to Count the salary of 10 employees including basic salary    Hrd,DA and PF */


#include<stdio.h>
#include<conio.h>
struct employee
{
    float hrd,da,pf,net,basic;
};
struct employee emp[3];
void main()
{
    int a;
    clrscr();
    printf("::  Enter Employee Salary  ::\n\n");
    for(a=0;a<3;a++)
    {
        printf("Enter Basic Salary of Employee %d -> ",a+1);
        scanf("%f",&emp[a].basic);
    }
    for(a=0;a<3;a++)
    {
        emp[a].hrd = (emp[a].basic * 15) / 100;
        emp[a].da = (emp[a].basic * 10 ) / 100;
        emp[a].pf = (emp[a].basic * 5 ) / 100;
        emp[a].net = (emp[a].basic + emp[a].hrd + emp[a].da ) - emp[a].pf;
    }
    for(a=0;a<3;a++)
    {
        printf("\n::: Detail of Employee %d :::",a+1);
        printf("\n Basic Salary -> %9.2f",emp[a].basic);
        printf("\n HRD          -> %9.2f",emp[a].hrd);
        printf("\n DA           -> %9.2f",emp[a].da);
        printf("\n PF           -> %9.2f",emp[a].pf);
        printf("\n Net Salary   -> %9.2f",emp[a].net);
        printf("\n");

    }
    getch();
}
float *ab(float *a)
{
    return a;
}

Post a Comment