Q:

Write a C Program to find the gross salary and net salary

0

Write a C Program to find the gross salary and net salary. Here’s simple Program to find the gross salary and net salary in C Programming Language.

Gross salary :

We need to take input from user and then apply the simple formula to calculate the gross salary i.e. gross salary= basic salary+ dearness allowance+ house rent allowance.

 
 

Net salary :

We need to take input from user and then apply the simple formula to calculate the net salary i.e. net salary = gross – tax + pf 

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

 

Below is the source code for C Program to find the gross salary and net salary which is successfully compiled and run on Windows System to produce desired output as shown below :

SOURCE CODE : :

/*  C Program to find the gross salary and net salary  */

#include<stdio.h>
int main()
{
    float basic, da, hra, tax, pf, gross, net;
    char name[50];

    printf("ENTER YOUR NAME :: ");
    scanf("%s", &name);
    printf("\nENTER THE BASIC SALARY :: ");
    scanf("%f", &basic);
    pf = 0.08 * basic;
    if (basic < 5000)
    {
    da = 0.3 * basic;
    hra = 0.08 * basic;
    }
    else if ((basic >= 5000) && (basic < 10000))
    {
    da = 0.4 * basic;
    hra = 0.1 * basic;
    }
    else
    {
    da = 0.5 * basic;
    hra = 0.2 * basic;
    }
    gross = basic + da + hra;
    net = gross - tax + pf;
    printf("\n\nTHE GROSS SALARY IS :: %f", gross);
    printf("\n\nTHE NET SALARY IS :: %f", net);

    return 0;

}

 

OUTPUT : :

 

ENTER YOUR NAME :: Codezclub

ENTER THE BASIC SALARY :: 3000


THE GROSS SALARY IS :: 4140.000000

THE NET SALARY IS :: 4380.000000

 

Above is the source code for C Program to find the gross salary and net salary which is successfully compiled and run on Windows System.The Output of the program is shown above .

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

C Basic Solved Programs – C Programming

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
Write a C Program to find the roots of quadratic e... >>
<< Write a C Program To find the biggest and smallest...