A salesman gets a commission of 5% on the sales he makes if his sales is below Rs.5000/- and a commission of 8% on the sales that exceeds Rs.5000/- or equal to 5000 together with Rs.250/-.Write an algorithm or a flowchart and develop C program for computing the commission of the salesman, given his sales.
Question
A salesman gets a commission of 5% on the sales he makes if his sales is below Rs.5000/- and a commission of 8% on the sales that exceeds Rs.5000/- or equal to 5000 together with Rs.250/-.Write an algorithm or a flowchart and develop C program for computing the commission of the salesman, given his sales.
Solution
Sure, here is the C program to compute the commission of the salesman based on the given conditions:
#include <stdio.h>
int main() {
float sales, commission;
printf("Enter the sales amount: ");
scanf("%f", &sales);
if(sales < 5000) {
commission = sales * 0.05;
} else {
commission = sales * 0.08 + 250;
}
printf("The commission of the salesman is: %.2f\n", commission);
return 0;
}
Here is the step by step explanation of the program:
- Include the standard input-output library using
#include <stdio.h>. - Define the main function using
int main(). - Declare the variables
salesandcommissionas float. - Ask the user to enter the sales amount using
printfand store the input insalesvariable usingscanf. - Check if
salesis less than 5000. If true, calculate the commission as 5% ofsales. If false, calculate the commission as 8% ofsalesplus 250. - Print the commission using
printf. - Return 0 to indicate that the program has executed successfully.
This program will calculate and print the commission of the salesman based on the sales amount entered by the user.
Similar Questions
Write a program that includes two functions. The first function should ask a salesperson for the price value of daily sales and then return this figure to the main program. The second function should calculate the salesperson’s commission based on the following rates:Sales (in rs)commission0-9993%1000-29993.5%3000- up4.5%The calculated commission should be returned to the main program, which then displays it.
IPS_6Write a program that includes two functions. The first function should ask a salesperson for the price value of daily sales and then return this figure to the main program. The second function should calculate the salesperson’s commission based on the following rates:Sales (in rs)commission0-9993%1000-29993.5%3000- up4.5%The calculated commission should be returned to the main program, which then displays it. Output:Enter the dollar value of daily sales: $1500Commission for the day: $52.50
A salesman is paid a basic salary of Sh 7100. He also gets 6% commission once he has sold goods for over Sh 70000. How much commission did he earn in a month in which he sold goods worth Sh 560000?
John works as a sales agent in a car company which gives a 12% commission in his total sales. John can close a sale of a car worth ₱1,000,000. He has a salary of ₱18,000 a month.How much is his commission?NOTE: Do not label your answer. Just type in your answer in number form only. No comma, no peso sign, no decimal, no space.
What type of commission is when a sales is paid a percentage of sales only?Responses
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.