EnableExplicit Procedure.i SumDigits(Number.q, Base) If Number < 0 : Number = -Number : EndIf; convert negative numbers to positive If Base < 2 : Base = 2 : EndIf ; base can't be less than 2 Protected sum = 0 While Number > 0 sum + Number % Base Number / Base Wend ProcedureReturn sum EndProcedure If OpenConsole() PrintN("The sums of the digits are:") PrintN("") PrintN("1 base 10 : " + SumDigits(1, 10)) PrintN("1234 base 10 : " + SumDigits(1234, 10)) PrintN("fe base 16 : " + SumDigits($fe, 16)) PrintN("f0e base 16 : " + SumDigits($f0e, 16)) PrintN("") PrintN("Press any key to close the console") Repeat: Delay(10) : Until Inkey() <> "" CloseConsole() EndIf