One large chemical company pays its salespeople on a commission basis. The salespeople each receive $250 per week plus 10 percent of their gross sales for that week. For example, a salesperson who sells $5000 worth of chemicals in a week receives $250 plus 10 percent of $5000, or a total of $750. Develop a C program to input each salesperson’s gross sales for last week and calculates and displays that salesperson’s earnings. Process one salesperson’s figures at a time.
Enter sales in dollars <-1 to end>:5000.00
Salary is: 750.00
Expert Answer
#include <stdio.h>
int main()
{
float gross_sales,salary=250; // variable declaration
do
{
printf(“Enter sales in dollars <-1 to end>: “);
scanf(“%f”,&gross_sales); // accept the gross sales
if(gross_sales!=-1) // gross sales is not -1
{
salary+=0.1*gross_sales; // calculate the salry
printf(“Salary is %.2fn”,salary); // print the salary
}
salary=250;
}
while(gross_sales!=-1); // check gross salry is -1 or not
return 0;
}
Output :