Microsoft Small Basic

Program Listing: LWS487
TextWindow.Write("Add up all the multiples of 3 and 5 below which number? :")
input = TextWindow.Read()

n3 = Math.Floor((input-1)/3)
n5 = Math.Floor((input-1)/5)

sum3 = 3 * n3 * (n3 + 1) / 2
sum5 = 5 * n5 * (n5 + 1) / 2

n15 = math.Floor(input/15)
sum15 = 15 * n15 * (n15 + 1) / 2

answer = sum3 + sum5 - sum15
TextWindow.Clear()
TextWindow.WriteLine("The answer is :" + answer)