// Program Description: Your aunt runs a business selling knives.
// She hires door-to-door salespeople in her
// business and has created a system of pay to
// give the salespeople great incentives for
// excellent performance. Your aunt has asked
// you to write a program that asks the salesperson
// how many knives they sold for the month and
// prints out how much he gets paid for the month.
#include <stdio.h>
int main(void)
{
int knives_sold = 0;
printf("How many knives did you sell this month?\n");
scanf("%d", &knives_sold);
if ( knives_sold<= 100 )
printf("You have earned $%d from this month's sales\n", knives_sold*5);
else(knives_sold>=101 || knives_sold<= 200);
int earnings=0;
earnings= (((knives_sold-100)*10)+500);
printf("You have earned $%d from this month's sales\n", earnings);
else(knives_sold>200};
int earnings_2=(2000+((knives_sold-200)*15))
printf("You have earned $%d from this month's sales\n", earnings_2);
system("PAUSE");
return 0;
}
should be 02.. don't mind that im just interested in compiling and running the program tonight. Is it ok to have two else statements or should there only be one?
#include <stdio.h>
int main(void)
{
int knives_sold = 0;
printf("How many knives did you sell this month?\n");
scanf("%d", &knives_sold);
if ( knives_sold<= 100 )
printf("You have earned $%d from this month's sales\n", knives_sold*5);
else(knives_sold>=101 || knives_sold<= 200);
int earnings=0;
earnings= (((knives_sold-100)*10)+500);
printf("You have earned $%d from this month's sales\n", earnings);
else(knives_sold>200};
int earnings_2=(2000+((knives_sold-200)*15))
printf("You have earned $%d from this month's sales\n", earnings_2);
system("PAUSE");
return 0;
}
#include <stdio.h>
int main(void)
{
int knives_sold = 0;
printf("How many knives did you sell this month?\n");
scanf("%d", &knives_sold);
if ( knives_sold<= 100 )
{
printf("You have earned $%d from this month's sales\n", knives_sold*5);
}
elseif(knives_sold>=101 || knives_sold<= 200)
{
int earnings;
earnings= (((knives_sold-100)*10)+500);
printf("You have earned $%d from this month's sales\n", earnings);
}
else(knives_sold>200)
{
int earnings_2=(2000+((knives_sold-200)*15))
printf("You have earned $%d from this month's sales\n", earnings_2);
}
system("PAUSE");
return 0;
}
ERROR: syntax error in line 35 and before printf in line 37