Answer:
int absoluteValue(int number) {
if (number < 0)
number = number * (-1);
else if (number > 0)
number = number;
else
number = 0;
return number;
}
Step-by-step explanation:
Create a function called absoluteValue that takes an integer parameter, number
Check if the number is smaller than 0. If it is, multiply the number with -1
Check if the number is greater than 0. If it is, assign it to itself
Check if the number is 0. If it is, assign it to 0
Return the number