C Program to Calculate Gross Salary of an Employee Using if-else
Gross Salary is the total salary of an employee before deductions. It generally includes Basic Salary, Dearness Allowance (DA), House Rent Allowance (HRA), Travel Allowance (TA) and other applicable benefits.
Gross Salary किसी कर्मचारी का कुल वेतन होता है, जिसमें से कटौतियाँ करने से पहले की राशि शामिल होती है। इसमें सामान्यतः Basic Salary, Dearness Allowance (DA), House Rent Allowance (HRA), Travel Allowance (TA) तथा अन्य लागू भत्ते शामिल होते हैं।
Program
#include <stdio.h>int main(void){float BS, GS, TA, DA, HRA, Bonus;printf("Enter basic salary: ");if (scanf("%f", &BS) != 1 || BS < 0){printf("Invalid basic salary.\n");return 1;}TA = 0.15f * BS;DA = 0.25f * BS;HRA = 0.10f * BS;if (BS >= 25000)Bonus = 10000;else if (BS >= 10000)Bonus = 5000;elseBonus = 0;GS = BS + TA + DA + HRA + Bonus;printf("\nBasic Salary = %.2f\n", BS);printf("TA = %.2f\n", TA);printf("DA = %.2f\n", DA);printf("HRA = %.2f\n", HRA);printf("Bonus = %.2f\n", Bonus);printf("Gross Salary = %.2f\n", GS);return 0;}
Output 1
Enter basic salary: 30000Basic Salary = 30000.00TA = 4500.00DA = 7500.00HRA = 3000.00Bonus = 10000.00Gross Salary = 55000.00
Output 2
Enter basic salary: 15000Basic Salary = 15000.00TA = 2250.00DA = 3750.00HRA = 1500.00Bonus = 5000.00Gross Salary = 27500.00
Output 3
Enter basic salary: 8000Basic Salary = 8000.00TA = 1200.00DA = 2000.00HRA = 800.00Bonus = 0.00Gross Salary = 12000.00
Explanation
The program accepts the basic salary from the user.
प्रोग्राम यूजर से Basic Salary इनपुट के रूप में प्राप्त करता है।
TA is calculated as 15%, DA as 25% and HRA as 10% of the basic salary.
TA की गणना Basic Salary के 15%, DA की 25% तथा HRA की 10% के रूप में की जाती है।
If the basic salary is greater than or equal to 25000, a bonus of 10000 is added.
यदि Basic Salary 25000 या उससे अधिक है, तो 10000 का बोनस जोड़ा जाता है।
Otherwise, if the basic salary is greater than or equal to 10000, a bonus of 5000 is added.
अन्यथा, यदि Basic Salary 10000 या उससे अधिक है, तो 5000 का बोनस जोड़ा जाता है।
If the basic salary is less than 10000, no bonus is added.
यदि Basic Salary 10000 से कम है, तो कोई बोनस नहीं जोड़ा जाता है।
Finally, the gross salary is calculated by adding Basic Salary, TA, DA, HRA and Bonus.
अंत में Basic Salary, TA, DA, HRA तथा Bonus को जोड़कर Gross Salary की गणना की जाती है।
Formula
Gross Salary = Basic Salary + TA + DA + HRA + Bonus
The allowance percentages and bonus amounts used in this program are assumed values for educational purposes. Actual salary structures depend on the applicable organization rules.
इस प्रोग्राम में दिए गए भत्तों के प्रतिशत और बोनस की राशि केवल शैक्षणिक उद्देश्य से मानी गई हैं। वास्तविक वेतन संरचना संबंधित संस्था के नियमों पर निर्भर करती है.
Comments
Post a Comment