CJCoding With Joseph

Largest Absolute Value

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

9

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
Topics:
Arrays
Code Editor
1
Tab to indent ยท Ctrl+Enter to run ยท 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.