C Program to Calculate Gross Salary of an Employee कर्मचारी का सकल वेतन ज्ञात करने का प्रोग्राम
In C language, the gross salary of an employee can be calculated by adding the basic salary and various allowances such as Travel Allowance (TA), Dearness Allowance (DA), and House Rent Allowance (HRA).
सी लैंग्वेज में कर्मचारी का सकल वेतन (Gross Salary) ज्ञात करने के लिए मूल वेतन (Basic Salary) में विभिन्न भत्तों जैसे यात्रा भत्ता (TA), महँगाई भत्ता (DA) तथा मकान किराया भत्ता (HRA) को जोड़ा जाता है।
Formula सूत्र:
For this program, assume that:
DA = 25% of Basic Salary
TA = 20% of Basic Salary
HRA = 10% of Basic Salary
Gross Salary = Basic Salary + TA + DA + HRA
इस प्रोग्राम में मान लिया गया है कि DA मूल वेतन का 25%, TA मूल वेतन का 20% तथा HRA मूल वेतन का 10% है।
C Program
#include <stdio.h>
int main(void)
{
float gs, bs, ta, da, hra;
printf("Enter basic salary: ");
scanf("%f", &bs);
da = (25 * bs) / 100;
ta = (20 * bs) / 100;
hra = (10 * bs) / 100;
gs = bs + ta + da + hra;
printf("\nBasic Salary = %.2f\n", bs);
printf("TA = %.2f\n", ta);
printf("DA = %.2f\n", da);
printf("HRA = %.2f\n", hra);
printf("Gross Salary = %.2f\n", gs);
return 0;
}Output
Enter basic salary: 20000
Basic Salary = 20000.00
TA = 4000.00
DA = 5000.00
HRA = 2000.00
Gross Salary = 31000.00Explanation व्याख्या:
In this program, the user enters the basic salary, which is stored in variable bs.
इस प्रोग्राम में यूजर मूल वेतन इनपुट करता है, जिसे bs वेरिएबल में स्टोर किया जाता है।
The program calculates DA, TA, and HRA using their respective percentages of the basic salary.
प्रोग्राम मूल वेतन के निर्धारित प्रतिशत के आधार पर DA, TA तथा HRA की गणना करता है।
Finally, all these amounts are added to calculate the gross salary, which is stored in variable gs.
अंत में मूल वेतन तथा सभी भत्तों को जोड़कर सकल वेतन ज्ञात किया जाता है और उसे gs वेरिएबल में स्टोर किया जाता है।
Note: The allowance percentages used in this program are assumed values for learning purposes. Actual salary structures may differ according to the employer and applicable rules.
Comments
Post a Comment