Tuesday 31 July 2012

Basic C Programming012


Write a program that calculates the net salary using entered basic salary.
Here, D.A. = 27%, H.R.A. = 10%, P.F. = 12% of basic salary; and M.A. = Rs.100, T.A.= Rs.1600 are fixed and I.T. = Rs.1000. Net salary = basic salary + (DA + HRA + MA + TA) - (PF + IT)
A program should print the output in the following format only:

ENTER BASIC SALARY (in Rs.) =40000
                  ALLOWANCES:
                  D.A. =10800.00
                  H.R.A. = 4000.00
                  M.A. = 100.00
                  T.A. = 1600.00
                  DEDUCTION:
                  P.F. = 4800.00
                  I.T. = 1000.00
-------------------------------------------
        NET SALARY = 50700.00


#include <stdio.h>
#include <conio.h>
void main ( )
{
        float      basic, da, hra, ma, ta, pf , it, net;
        clrscr( );
               
        printf ("\n\n\n\t\t ENTER BASIC SALARY (in Rs.)="); scanf("%f",&basic);
             
        da = ( basic * 27 ) / 100;
        hra = ( basic * 10 ) / 100;
        pf = ( basic * 12 ) / 100;
        ma = 100;
        ta = 1600;
        it = 1000;
        net = ( basic + da + hra + ma + ta) - ( pf + it );
                        
        printf ("\n\t\t\t ALLOWANCES: \n\t\t\t______________ \n");
        printf ("\n\t\t\t D.A.=%.2f",da);
        printf ("\n\t\t\t H.R.A.=%.2f",hra);
        printf ("\n\t\t\t M.A.=%.2f",ma);
        printf ("\n\t\t\t T.A.=%.2f",ta);
        printf ("\n\n\t\t\t DEDUCTION:\n");
       printf ("\n\t\t\t P.F.=%.2f",pf);
       printf ("\n\t\t\t I.T.=%.2f",it);
       printf ("\n\t\t\t___________________\n");
       printf("\n\t\t\t NET SALARY=%.2f",net);
          
       getch( );
}

Click here to contact us

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...