C Example: Payroll: hours × rate, progressive tax and net pay table

🗓 Last updated: 2026-11-30👤 Written by: Ivy✓ Reviewed by: Alex🏷 Category: Mini Apps

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.

⚡ Intermediate Reference entries: kw-structfn-printfkw-double
🖥 Run OnlineGCC 10.2 · C11 standard · click ▶ to run · Copy code
🖨 Reference OutputMatches the online run in a standard C11 environment
C · GCC 10.2 · -std=c11
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

🙏 帮我们做得更好

我们是刚上线的编程教程站,几个人的小团队,精力有限。页面虽经检查,难免还有疏漏——链接失效、排版错乱、内容有误、语言生硬……

如果您发现了,麻烦告诉我们,我们会在收到反馈后第一时间进行修复,再次感谢您的光临 🙏