RosettaCodeData/Task/Ethiopian-multiplication/Microsoft-Small-Basic/ethiopian-multiplication.basic

19 lines
335 B
Text
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
x = 17
y = 34
tot = 0
While x >= 1
TextWindow.Write(x)
TextWindow.CursorLeft = 10
If Math.Remainder(x + 1, 2) = 0 Then
tot = tot + y
TextWindow.WriteLine(y)
Else
TextWindow.WriteLine("")
EndIf
x = Math.Floor(x / 2)
y = 2 * y
EndWhile
TextWindow.Write("=")
TextWindow.CursorLeft = 10
TextWindow.WriteLine(tot)