Absolute value of a number

defati1983 Posted messages 54 Status Member -  
 tfi -
Hello
I'm still just starting out in programming and I have a small problem... I want to know what to write to create a program that asks for the absolute value of a number... Thank you for replying quickly.

9 answers

  1. kilian Posted messages 8675 Registration date   Status Moderator Last intervention   1 526
     
    Hi,

    The absolute value of a number is the number in positive no matter what, right?

    So it's simple, in algorithm it would look like:
    If (number < 0) then number := 0-number End If
    11