CJCoding With Joseph
15free / daySign inCreate account

Shipping Cost by Weight

The variable weight is a package weight in kilograms. Work out the shipping cost with an if / else if / else chain: 5 for 1 kg or less, 10 for 2 to 5 kg, 20 for 6 to 10 kg, and 50 for anything heavier. Store the result in the variable cost and print it once after the chain in the form Cost: <cost>.

Expected Output:

Cost: 10

= newline. The output ends with a newline — print one after the last line.

Hints3 available
Topics:
If Statements
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (clog, fn, fori)

Your Output

Run your code to see the output here...

Test Cases

Run your code to see test case results.