Absolute Value
easyQuestion 323An integer n = -7 is given. Print its absolute value (its distance from zero) using an if statement (see Expected Output).
Do not use the abs library function and do not hardcode 7. If n is negative, print -n; otherwise print n.
Expected output
7= newline. No newline after the last line.
Hints3 available
Sign in to use hintsTopics
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 (p, fori)
Your output
Run your code to see the output here...
Test cases
Run your code to see test case results.