This is a program to calculate salary. (at least to try to=). Well, it is supposed that all the information is given by the user. For the first 40 hours or less the salary is equal to rate * hours. After 40 hours the salary =(additional hours )* (1.5 *rate) rate + (rate*40)
What I am doing wrong???
thanks
#include <stdio.h>
int main()
{
float salary;
int rate, hours;
printf( "Enter # of hours worked (-1 to end): " );
scanf( "%d", &hours );
while ( hours != -1 ){
printf( "Enter hourly rate of the worker ($00.00): " );
scanf( "%d", &rate );
if ( hours <= 40 )
salary = hours * rate;
else
salary = ( float ) (hours - 40) * (3/2 * rate) + (40 * rate);
printf( "Salary is %.2f\n\n\n", salary );
}
return 0;
}