Absolute value

Write a function that returns the absolute value of an integer @n@.

Interface

+--------:+:---------------------------------------+
| C++     |     int absolute(int n);               |
+---------+----------------------------------------+
| C       |     int absolute(int n);               |
+---------+----------------------------------------+
| Java    |     public static int absolute(int n); |
+---------+----------------------------------------+
| Haskell |     absolute :: Int -> Int             |
+---------+----------------------------------------+
| Python  |     absolute(n)  # returns int         |
+---------+----------------------------------------+
|         |     absolute(n: int) -> int            |
+---------+----------------------------------------+

Observation

You only need to submit the required procedure; your main program will
be ignored.

Problem information

Author: Unknown
Translator: Salvador Roura

Generation: 2026-01-25T12:09:59.584Z

© Jutge.org, 2006–2026.
https://jutge.org
