C Program to compute the employee salary.


#include<stdio.h>
#include<conio.h>

struct salary_rec
{
   float basic;
   float da;
   float hra;
   float others;
};
struct emp_rec
{
   int emp_code;
   char emp_name[21];
   struct salary_rec salary;

};


void main()
{
   struct emp_rec emp;
   float total;
   clrscr();
   printf("\n\tEnter the details\n\nEmployee name\t: ");
   gets(emp.emp_name);
   printf("\nEmployee code\t: ");
   scanf("%d",&emp.emp_code);

   printf("\nBasic pay\t: ");
   scanf("%f",&emp.salary.basic);
   printf("\nHRA\t\t: ");
   scanf("%f",&emp.salary.hra);
   printf("\nDA\t\t: ");
   scanf("%f",&emp.salary.da);
   printf("\nOther allowance\t: ");
   scanf("%f",&emp.salary.others);
   total=emp.salary.basic+emp.salary.hra+emp.salary.da+emp.salary.others;
   printf("\n\t%s's salary is Rs. %7.2f",emp.emp_name,total);
   getch();



}