I've edited the codes but now I keep getting errors like "expected expression before '>' token".
I thought this is an expression
Code:
if (unit => 100 && unit <= 200)
By the way, can I know what does this "[b] means?
Code:
[b]bonus = 0.02;[b]
This is the code I've edited so far.
Code:
#include <stdio.h>
int main()
{
int unit;
float salary, bonus;
char staff;
printf("\n-------------------------------------");
printf("\n BONUS ");
printf("\n-------------------------------------");
printf("\nEnter the staff name : ");
scanf("%c", &staff);
printf("\nEnter the salary : RM ");
scanf("%f", &salary);
printf("\nEnter the units sold : ");
scanf("%d", &unit);
salary = unit * bonus;
if (unit => 100 && unit <= 200) {
bonus =0.02;
}
else if (unit => 201 && unit <= 300){
bonus =0.04;
}
else (unit => 300){
bonus =0.06;
}
salary = unit * bonus;
printf("\nStaff name : %c ", staff);
printf("\nSalary : %f ", salary);
printf("\nUnits Sold : %d ", unit);
printf("\nBonus Percentage : %.2f ", bonus);
printf("\nBonus Amount : ");
printf("\nTotal Salary : RM ");
return 0;
}