fork download
  1. //*******************************************************
  2. //
  3. // Homework: 1 (Chapter 4/5)
  4. //
  5. // Name: Izebel R
  6. //
  7. // Class: C Programming, Spring 2023
  8. //
  9. // Date: 1/29/23
  10. //
  11. // Description: Program which determines gross pay and outputs
  12. // to the screen. This version does not use file pointers
  13. //
  14. //
  15. //********************************************************
  16.  
  17. #include <stdio.h>
  18. int main()
  19. {
  20.  
  21. int clock_num; /* employee clock number */
  22. float gross; /* gross pay for week (wage * hours) */
  23. float hours; /* number of hours worked per week */
  24. float wage; /* 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", &clock_num);
  31. printf ("\n\tEnter hourly wage for employee: ");
  32. scanf ("%f", &wage);
  33. printf ("\n\tEnter the number of hours the employee worked: ");
  34. scanf ("%f", &hours);
  35.  
  36. /* calculate gross pay */
  37. gross = wage * hours;
  38.  
  39. /* print out employee information */
  40. printf ("\n\n\t----------------------------------------------------------\n");
  41. printf ("\tClock # \tWage \tHours \tGross\n");
  42. printf ("\t----------------------------------------------------------\n");
  43.  
  44. printf ("\t%06i \t\t$%5.2f \t%5.1f \t$%7.2f\n",clock_num, wage, hours, gross);
  45.  
  46. return (0); /* success */
  47.  
  48. } /* main */
  49.  
Success #stdin #stdout 0s 5472KB
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.00