← Back to If Statements
Question 215
Absolute Value By Hand
Absolute Value By Hand
Read a whole number and print how far it is from zero without calling abs(): a negative number is printed with its sign removed, any other number is printed as it is. Input: one integer, no prompt. Output: one line holding the distance.
Expected Output:
8= newline. The output ends with a newline — print one after the last line.
Hints2 available
Sign in to use hintsTopics:
If Statements
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Ctrl+Space to expand shortcuts (pr, inp, def)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.