โ Back to If Statements
Question 253
Absolute Value
Absolute Value
An integern = -7is given. Print its absolute value (its distance from zero) using anifstatement: 7 Do not use theabslibrary function and do not hardcode7. Ifnis negative, print-n; otherwise printn.
Expected Output:
7
Topics:
If Statements
Code Editor
1
Tab to indent ยท Ctrl+Enter to run ยท 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.