fork(1) download
  1.  
  2.  
  3. #include <stdio.h>
  4. int main ()
  5. {
  6.  
  7. int clockNumber;
  8. float gross;
  9. float hours;
  10. float wageRate;
  11.  
  12. printf ("\n\t*** Pay Calculator ***\n");
  13.  
  14.  
  15. printf ("\n\tEnter clock number for employee: ");
  16. scanf ("%d", &clockNumber);
  17. printf ("\n\tEnter hourly wage for employee: ");
  18. scanf ("%f", &wageRate);
  19. printf ("\n\tEnter the number of hours the employee worked: ");
  20. scanf ("%f", &hours);
  21.  
  22.  
  23. gross = wageRate * hours;
  24.  
  25.  
  26. printf ("\n\n\t----------------------------------------------------------\n");
  27. printf ("\tClock # Wage Hours Gross\n");
  28. printf ("\t----------------------------------------------------------\n");
  29.  
  30. printf ("\t%06i %5.2f %5.1f %7.2f\n", clockNumber, wageRate, hours, gross);
  31.  
  32. return (0); // success
  33.  
  34. } // main
Success #stdin #stdout 0s 5320KB
stdin
98401
10.60
51.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
	----------------------------------------------------------
	098401 10.60  51.0  540.60