salario.c (608B)
1 /* Esercizio 3.21 (Cap. 3) 2 * 3 * Determina la paga lorda per ogni impiegato 4 */ 5 6 #include <stdio.h> 7 8 int main() 9 { 10 int hours; 11 float rate; 12 13 printf("Enter # of hours worked (-1 to end): "); 14 scanf("%d", &hours); 15 16 while(hours != -1) { 17 printf("Enter hourly rate of the worker ($00.00): "); 18 scanf("%f", &rate); 19 20 printf("Salary is $"); 21 if (hours <= 40) 22 printf("%.2f\n\n", rate * hours); 23 else 24 printf("%.2f\n\n", rate * 40 + rate + rate / 2); 25 26 printf("Enter # of hours worked (-1 to end): "); 27 scanf("%d", &hours); 28 } 29 30 return 0; 31 } /* E0F main */ 32