fork download
  1. //*******************************************************
  2. // Homework: 1 (Chapter 4/5)
  3. // Name: Steve Haguma
  4. // Class: C Programming, 2025
  5. // Date: September 14, 2025
  6. // Non file pointer solution
  7. //********************************************************
  8.  
  9. #include <stdio.h>
  10.  
  11. int main ()
  12. {
  13. int clockNumber;
  14. float gross;
  15. float hours;
  16. float wageRate;
  17.  
  18. printf ("\n\t Pay Calculator \n");
  19.  
  20.  
  21. printf ("\n\tEnter clock number for employee: ");
  22. scanf ("%d", &clockNumber);
  23.  
  24. printf ("\n\tEnter hourly wage for employee: ");
  25. scanf ("%f", &wageRate);
  26.  
  27. printf ("\n\tEnter the number of hours the employee worked: ");
  28. scanf ("%f", &hours);
  29.  
  30.  
  31. gross = wageRate * hours;
  32.  
  33.  
  34. printf ("\n\n\t----------------------------------------------------------\n");
  35. printf ("\tClock # Wage Hours Gross\n");
  36. printf ("\t----------------------------------------------------------\n");
  37. printf ("\t%06i %5.2f %5.1f %7.2f\n", clockNumber, wageRate, hours, gross);
  38.  
  39. return (0);
  40. }
Success #stdin #stdout 0.01s 5320KB
stdin
34645
   12.25
   45.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
	----------------------------------------------------------
	034645  12.25   45.0   551.25