C Example: Payroll: hours × rate, progressive tax and net pay table
Computes gross pay from hours and hourly rate, then applies a two-bracket progressive tax: 10% up to 1000 and 20% above it; prints each employee's gross, tax and net plus company totals. The table is aligned with printf widths — a simplified payroll model.
🖥 Run OnlineGCC 10.2 · C11 standard · click ▶ to run · Copy code
🖨 Reference OutputMatches the online run in a standard C11 environment
name hours rate gross tax net Ada 40.0 25.00 1000.00 100.00 900.00 Grace 45.0 18.00 810.00 81.00 729.00 Linus 38.0 32.50 1235.00 147.00 1088.00 Ken 20.0 15.00 300.00 30.00 270.00 Margaret 50.0 40.00 2000.00 300.00 1700.00 total gross 5345.00, tax 658.00, net 4687.00
🧩 Keep Learning