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

By | 02.11.2016

Find the gross salary and net salary


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 


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 .

If you found any error or any queries related to the above program or any questions or reviews , you wanna to ask from us ,you may Contact Us through our contact Page or you can also comment below in the comment section.We will try our best to reach up to you in short interval.


Thanks for reading the post….

5 1 vote
Article Rating
Category: Basic Programs C Programming Tags:

About Tunde A

My name is Tunde Ajetomobi, a Tech Enthusiast and Growth Hacker. I enjoy creating helpful content that solves problem across different topics. Codezclub is my way of helping young aspiring programmers and students to hone their skills and find solutions on fundamental programming languages.

Subscribe
Notify of
guest

2 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Lakshmi

How do we calculate tax …? You didn’t mention how to calculate tax here

Shreya

How to calculate amount of 10 item using array of structure??