fork download
  1. //*******************************************************
  2. //
  3. // Homework: 1 (Chapter 4/5)
  4. //
  5. // Name: Madelin Vera
  6. //
  7. // Class: C Programming, Fall 2026
  8. //
  9. // Date: September 11, 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.  
  18. #include <stdio.h>
  19. int main ()
  20. {
  21.  
  22. int employee_clock_number = 34635; // employee clock number
  23. float gross_pay = 551.25; // gross pay for week (wage * hours)
  24. float number_of_hours_per_week = 45.0; // number of hours worked per week
  25. float hourly_wage = 12.25; // hourly wage
  26.  
  27. printf ("\n\t*** Pay Calculator ***\n");
  28.  
  29. // Prompt for input values from the screen
  30. printf ("\n\t34635");
  31. scanf ("%d", & employee_clock_number );
  32. printf ("\n\t12.15");
  33. scanf ("%f", & hourly_wage);
  34. printf ("\n\t45.0");
  35. scanf ("%f", & number_of_hours_per_week);
  36.  
  37. // calculate gross pay
  38. gross_pay = hourly_wage * number_of_hours_per_week ;
  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 %7.2f\n", employee_clock_number, hourly_wage, number_of_hours_per_week, gross_pay);
  45.  
  46. return (0); // success
  47.  
  48. } // main
Success #stdin #stdout 0s 5320KB
stdin
34645
12.25
45
stdout
	*** Pay Calculator ***

	34635
	12.15
	45.0

	----------------------------------------------------------
	Clock # Wage Hours Gross
	----------------------------------------------------------
	034645 12.25  45.0  551.25