fork download
  1.  
  2. /*Homework: 1
  3.  
  4. Name:Robert Richard
  5.  
  6. CLass: C programming <Spring 2023>
  7.  
  8. Date: 1/26/2023
  9.  
  10. Description: Program which determines gross pay and the
  11. output is sent to standard output (the screen)*/
  12.  
  13.  
  14. #include <stdio.h>
  15. int main()
  16. {
  17. int clockNum;
  18. float grossPay;
  19. float hoursWorked;
  20. float hourlyWage;
  21. printf ("This is a program to calculate gross pay.\n");
  22. printf ("You will be prompted for employee data.\n\n");
  23. printf ("Enter clock number for employee: ");
  24. scanf ("%d", &clockNum);
  25. printf ("Enter hourly wage for employee: ");
  26. scanf ("%f", &hourlyWage);
  27. printf ("Enter the number of hours the employee worked: ");
  28. scanf ("%f", &hoursWorked);
  29.  
  30. grossPay = hourlyWage * hoursWorked;
  31.  
  32. printf ("\n\t\tC Programming, First Homework Assignment\n\n\n");
  33. printf ("\t----------------------------------------------------------\n");
  34. printf ("\tClock # Wage Hours Gross\n");
  35. printf ("\t----------------------------------------------------------\n");
  36.  
  37. printf ("\t%06i %5.2f %5.1f %7.2f\n",
  38. clockNum, hourlyWage, hoursWorked, grossPay);
  39. return 0;
  40. }
  41.  
Success #stdin #stdout 0.01s 5380KB
stdin
98401
10.60
51.0
stdout
This is a program to calculate gross pay.
You will be prompted for employee data.

Enter clock number for employee: Enter hourly wage for employee: Enter the number of hours the employee worked: 
		C Programming, First Homework Assignment


	----------------------------------------------------------
	Clock # Wage Hours Gross
	----------------------------------------------------------
	098401 10.60  51.0  540.60