#include <stdio.h>
int main (void)
{
//declare variables
int sales = 0;
int totalsales =0;
double commission = 0.0;
//enter input items
printf("\nsales: ");
scanf("%d", &totalsales);
//determine whether the data is valid
if (sales <= 0 && commission = -1);
else if (sales <= 10000 && commission = sales*0.2);
else if (sales <= 40000 && commission = sales*.05 + 2000);
else if (sales >= 40000 && commission = sales*.1 + 17000);
{
//calculate and display the output
sales = sales <= 0 ;
commission = -1 ;
sales = sales <= 10000 ;
commission = sales*0.2 ;
sales = sales <= 40000 ;
commission = sales*.05 + 2000 ;
sales = sales >= 40000 ;
commission = sales*.1 + 17000 ;
printf("\nsales %d ", totalsales);
printf("\ntotalcommissions: %.0f%% \n\n", commission);//zero decimal places
}
else
printf("Input error!!");
return 0;
}
muhd.hadziq 0 Newbie Poster
SenthilAnand 0 Newbie Poster
Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster
ddanbe commented: The final touch! +15
muhd.hadziq 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.