Previous
0 / 8
Module DEMO-32-55DEMO-C-32

Salary Calculator

DEMO-C-32 โ€ข Programming in C

Browser-only practice

Problem Statement

John just got a new job at a tech company. His manager asked him to calculate his monthly take-home salary after deducting taxes and insurance.

The calculation is simple: Take-home salary = Gross salary - (Tax amount + Insurance amount)

John needs to write a program that takes his gross salary, tax amount, and insurance amount as inputs and calculates his take-home salary.

This is a real-life scenario where basic arithmetic operations are used to solve financial calculations.

Constraints

Gross salary will be between 1000.00 and 100000.00 Tax amount will be between 0.00 and 30000.00 Insurance amount will be between 0.00 and 5000.00 All inputs are valid floating-point numbers Take-home salary will always be positive

Input Format

The input consists of three floating-point numbers on a single line, separated by spaces:

  1. Gross salary (in dollars)
  2. Tax amount (in dollars)
  3. Insurance amount (in dollars)

Output Format

Output a single floating-point number representing the take-home salary, rounded to exactly 2 decimal places.

Sample Testcases

Submit runs every public testcase in this browser. Results and code never leave this device.

Sample #1
Public sample
5000.00 800.00 200.00
4000.00
Gross salary: $5000.00, Tax: $800.00, Insurance: $200.00. Take-home = 5000 - (800 + 200) = $4000.00

Web terminal

C, C++, Java, and Python run locally in a browser VM. No worker or visualizer is used.

Saved in this browser
Editor settings