fork download
  1. /* This is week two assignment one
  2. This is to find the Gross Pay of 5 employees
  3. 5
  4. 98401 10.60 51.0
  5. 526448 9.75 42.5
  6. 765349 10.50 37.0
  7. 34645 12.25 45.0
  8. 127615 8.35 0.0 */
  9.  
  10. #include <stdio.h>
  11.  
  12. int main (void)
  13. {
  14. // Declare and assign variables
  15. int n, number, clockNumber;
  16. float hourlyWage, numberHours, grossPay;
  17.  
  18. // Printing Main Heading which includes a double return
  19. printf (" ***Pay Calculator*** \n\n");
  20.  
  21. printf ("Enter number of employees to process?\n");
  22. printf ("Enter Employee's Clock #?\n");
  23. printf ("Enter hourly wage?\n");
  24. printf ("Enter number of hours worked?\n\n");
  25.  
  26. // Printing two subheadings
  27. printf ("Clock Wage Hours Gross Pay\n");
  28. printf ("----- ---- ----- ---------\n");
  29.  
  30. //count number
  31. scanf ("%i", &number);
  32.  
  33. for ( n = 1; n <=number; ++n )
  34. {
  35. scanf ("%i", &clockNumber);
  36. scanf ("%g", &hourlyWage);
  37. scanf ("%g", &numberHours);
  38. grossPay = (numberHours * hourlyWage);
  39.  
  40. printf ("%6i %g %g %g\n", clockNumber, hourlyWage, numberHours, grossPay);
  41. }
  42.  
  43. return 0;
  44.  
  45. }
Success #stdin #stdout 0s 10304KB
stdin
5
98401 10.60 51.0
526448 9.75 42.5
765349 10.50 37.0
34645 12.25 45.0
127615 8.35 0.0
stdout
       ***Pay Calculator***      

Enter number of employees to process?
Enter Employee's Clock #?
Enter hourly wage?
Enter number of hours worked?

Clock          Wage          Hours         Gross Pay
-----          ----          -----         ---------
 98401       10.6      51        540.6
526448       9.75      42.5        414.375
765349       10.5      37        388.5
 34645       12.25      45        551.25
127615       8.35      0        0