Tuesday, 4 September 2012

WAP to Find the net salary on basis of basic salary.

  • WAP to Find the net salary on basis of basic salary.

#include <stdio.h>
#include <conio.h>
void main()
{
    float bs,gs,ns,hra,da,pf;
    char c;
    printf("Enter 'f' for female and 'm' for male");
    scanf("%c",&c);
    printf("Enter the basic salary");
    scanf("%f",&bs);
    if(bs>=5000)
    {
        if(c=='f')
            {
            hra=(15/100)*bs;
            da=(10/100)*bs;
            pf=(8/100)*bs;
            }
            else
            {
            hra=(20/100)*bs;
            da=(15/100)*bs;
            pf=(10/100)*bs;
            }
        }
            else
            {
                hra=(10/100)*bs;
                da=(9/100)*bs;
                pf=(8/100)*bs;
                }

                gs=bs+hra+da;
                ns=gs-pf;
                printf("%f is the gross salary",gs);
                printf("%f is the net salary",ns);
            }

No comments:

Post a Comment