Programming Examples
Write a program to calculate the salary based on sales?
Write a program to calculate the salary of a medical representative based on the sales. Bonus and incentive to be offered to him will be based on total sales. If the sale exceeds or equals to Rs.1,00,000, follow the particulars of Table 1, otherwise follow Table 1 TABLE 2.
TABLE 1: | TABLE 2: |
Basic=Rs. 3000. | Basic=Rs. 3000. |
Hra=20% of basic | Hra=20% of basic |
Da=110% of basic | Da=110% of basic. |
Conveyance=Rs.500. | Conveyance=Rs.500. |
Incentive=10% of sales. | Incentive=5% of sales. |
Bonus=Rs. 500. | Bonus=Rs. 200 |
Solution
void main()
{
float bs,hra,da,cv,incentive,bonus,sale,ts;
clrscr();
printf(“\n Enter Total Sales in Rs.:”);
scanf(“%f”, &sale);
if(sale>=100000)
{
bs=3000;
hra=20 * bs/100;
da=110 * bs/100;
cv=500;
incentive=sale*10/100;
bonus=500;
}
else
{
bs=3000;
hra=20 * bs/100;
da=110 * bs/100;
cv=500;
incentive=sale*5/100;
bonus=200;
}
ts=bs+hra+da+cv+incentive+bonus;
printf(“\nTotal Sales : %.2f”,sale);
printf(“\nBasic Salary : %.2f”’,bs)
printf(“\nHra : %.2f”,hra);
printf(“\nDa : %.2f”,da);
printf(“\nConveyance : %.2f”,cv);
printf(“\nIncentive : %.2f”,incentive);
printf(“\nBonus : %.2f”,bonus);
printf(“\nGross Salary : %.2f”,ts);
getch();
}
Output
OUTPUT:
Enter a Number : 25
Square = 625