CJCoding With Joseph
15free / daySign inCreate account

Largest Absolute Value

The array {3, -7, 2, -9, 4} is given. Find the largest absolute value (magnitude) among the elements and print it (see Expected Output).

The magnitudes are 3, 7, 2, 9, 4, so the answer is 9. Use Math.abs and print the magnitude, not the original signed value.

Expected Output:

9

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

Hints4 available
Topics:
Arrays
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (sysout, psvm, fori)

Your Output

Run your code to see the output here...

Test Cases

Run your code to see test case results.