Click here to Skip to main content
15,902,445 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
C#
#include<stdio.h>
int main()
{
    char gender,qual;
    int yos,sal=0;
    printf("enter gender qualification year of service and sal of employe\n");
    scanf("%c%c%d%d",&gender,&qual,&yos,&sal);

    if (gender=='M')
    {
        if((yos>=10)&&(qual=='pg'))
            sal=15000;
            else if ((yos>=10)&&(qual=='g')||(yos<10)&&(qual=='pg'))
            sal=10000;
            else if ((yos<10)&&(qual=='g'))
            sal=7000;
    }
    else if ((yos>=10)&&(qual=='pg'))
    sal=12000;
    else if ((yos>=10)&&(qual=='g'))
    sal=9000;
    else if ((yos<10)&&(qual=='pg'))
    sal=10000;
    else if((yos<10)&&(qual=='g'))
    sal=6000;

    printf("sal of employe is=%d\n",sal);
    return 0;

}
Posted

1 solution

"Is not working properly" is not a good starting point to search for an error. Could you please be a little more specific.

What I can see right away is that the condition
C++
qual=='pg'

can't work if qual is of type char. qual can only store a single character!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900