You'd have to do it like this:
Code:
printf("Enter # of hours worked (-1 to end):");
scanf("%d",&hrs);
while (hrs != -1){
printf("Enter hourly rate of worker ($00.00):");
scanf("%f",&rate);
if(hrs<=40){
salary = rate*hrs;
}
if(hrs>40){
salary = (rate*40)+((hrs-40)*rate*1.5);
}
printf("Salary is %.2f \n", salary);
printf("Enter # of hours worked (-1 to end):");
scanf("%d",&hrs);
}
And you can get rid of the warning by changing the floats to doubles. But you'd also have to change the scanf for rate so it uses %lf.