fork download
  1. //*******************************************************
  2. //
  3. // Homework: 1 (Chapter 4/5)
  4. //
  5. // Name: <Felix Henriquez>
  6. //
  7. // Class: C Programming, <Fall 2025>
  8. //
  9. // Date: <9/14/2025>
  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 clockNumber; // employee clock number
  23. float gross; // gross pay for week (wage * hours)
  24. float hours; // number of hours worked per week
  25. float wageRate; // hourly wage
  26.  
  27. printf ("\n\t*** Pay Calculator ***\n");
  28.  
  29. // Prompt for input values from the screen
  30. printf ("\n\t197620");
  31. scanf ("%d", &clockNumber);
  32.  
  33. printf ("\n\t20 ");
  34. scanf ("%f", &wageRate);
  35.  
  36. printf ("\n\t40");
  37. scanf ("%f", &hours);
  38.  
  39. // calculate gross pay
  40. gross = wageRate * hours;
  41.  
  42. // print out employee information
  43. printf ("\n\n\t----------------------------------------------------------\n");
  44. printf ("\tClock # Wage Hours Gross\n");
  45. printf ("\t----------------------------------------------------------\n");
  46.  
  47. printf ("\t%06i %5.2f %5.1f %7.2f\n", clockNumber, wageRate, hours, gross);
  48.  
  49. return (0); // success
  50.  
  51. } // main
Success #stdin #stdout 0.01s 5312KB
stdin
23456
23.45
46.1
stdout
	*** Pay Calculator ***

	197620
	20 
	40

	----------------------------------------------------------
	Clock # Wage Hours Gross
	----------------------------------------------------------
	023456 23.45  46.1 1081.05