/* Program to read hours worked for each of a company's employees, and print the salary owing to each one. */ #include main () { float hours, salary; printf("Enter hours worked for an employee (-1 to finish): "); scanf("%f", &hours); while (hours != -1.) { if (hours <= 40.) { salary = hours * 25; /* $25/hour up to 40 hours */ } else { salary = 40 * 25 + (hours - 40) * 35; /* $25/hour for first 40, then $35/hour */ } printf("Salary is %.2f\n\n", salary); printf("Enter hours worked for an employee (-1 to finish): "); scanf("%f", &hours); } }