Turbo C Programming

Discussion in 'C' started by Tabyo, May 16, 2011.

  1. Tabyo

    Tabyo New Member

    Joined:
    May 15, 2011
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    ..Hi Im a 1st year I.T students please help me create a program using structures that accepts 50 employees and Display the net and gross pay. And when you enter the records you just accept and accept but when you exit, all the accepted records will be printed....please help I need it so badly...:):):):person:
     
  2. Ann_beginner

    Ann_beginner New Member

    Joined:
    Apr 10, 2011
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    0
    Code:
    /*Program to calculate net salary of 'n'(50 in ur case) employees when
    hra = 50% of basic salary,
    da(dearness allowance) = 25% of basic
    ta(travelling allowance) = 5% of basic
    ptax(professional tax) = rs.200*/
    
    #include<stdio.h>
    #include<conio.h>
    
    void main()
    {
    	float hra[20],
    	      da[20],
    	      ta[20],
    	      gross[20],
    	      net_sal[20];
    	int basic[20],
    	    ptax = 200,
    	    i,n;
    
    	clrscr();
    
    	printf("\nHOW MANY EMPLOYEES ARE THERE ? ");
    	scanf("%d",&n);
    
    	for(i=0; i<n; i++)
    	{
    		printf("\nENTER BASIC SALARY FOR EMPLOYEE %d :",i+1);
    		scanf("%d",&basic[i]);
    
    		hra[i] = (50*basic[i])/100;
    		da[i] = (25*basic[i])/100;
    		ta[i] = (5*basic[i])/100;
    
    		gross[i] = basic[i] + hra[i] + da[i] + ta[i];
    		net_sal[i] = gross[i] - ptax;
    	}
    	printf("\n\nBASIC SALARY\tGROSS SALARY\tNET SALARY");
    	for(i=0;i<n;i++)
    		printf("\n%d\t\t%.2f\t%.2f",basic[i],gross[i],net_sal[i]);
    
    
    	getch();
    }
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice