fork download
  1. //*******************************************************
  2. //
  3. // Homework: 1 (Chapter 4/5)
  4. //
  5. // Name: Adrian
  6. //
  7. // Class: C Programming, fall 2026
  8. //
  9. // Date: <September 8 2026>
  10. //
  11. // Description: Program which determines gross pay and outputs
  12. // to the screen. This version does not use file pointers
  13. //
  14. // Non file pointer solution
  15. //
  16. //********************************************************
  17. #include <stdio.h>
  18. int main ()
  19. {
  20.  
  21. int clocknumber; // employee clock number
  22. float gross; // gross pay for week (wage * hours)
  23. float hours; // number of hours worked per week
  24. float wagerate; // hourly wage
  25.  
  26. printf ("\n\t Pay Calculator \n");
  27.  
  28. // Prompt for input values from the screen
  29. printf ("\n\tEnter clock number for employee: ");
  30. scanf ("%d", &clocknumber);
  31. printf ("\n\tEnter hourly wage for employee: ");
  32. scanf ("%f", &wagerate);
  33. printf ("\n\tEnter the number of hours the employee worked: ");
  34. scanf ("%f", &hours);
  35.  
  36. //Calculate gross pay
  37. gross = wagerate * hours;
  38.  
  39. // print out employee information
  40. printf ("\n\n\t----------------------------------------------------------\n");
  41. printf ("\tClock # Wage Hours Gross\n");
  42. printf ("\t----------------------------------------------------------\n");
  43.  
  44. printf ("\t%06i %5.2f %5.1f %4.1f\n", clocknumber, wagerate, hours, gross);
  45.  
  46. return (0);
  47. }
Success #stdin #stdout 0s 5280KB
stdin
127615 8.35 0.0
stdout
	    Pay Calculator    

	Enter clock number for employee: 
	Enter hourly wage for employee: 
	Enter the number of hours the employee worked: 

	----------------------------------------------------------
	Clock # Wage Hours Gross
	----------------------------------------------------------
	127615  8.35   0.0  0.0