Microsoft Small Basic
Program Listing:
Embed this in your website
<object id='sbapp' data='data:application/x-silverlight-2,' type='application/x-silverlight-2' width='640' height='480'> <param name='source' value='http://smallbasic.com/program/ClientBin/SBWeb.xap'/> <param name='onError' value='onSilverlightError' /> <param name='background' value='white' /> <param name='minRuntimeVersion' value='3.0.40624.0' /> <param name='autoUpgrade' value='true' /> <param name='initParams' value='programId=KNR835' /> </object>
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
-
1
)
/
15
)
sum15
=
15
*
n15
*
(
n15
+
1
)
/
2
answer
=
sum3
+
sum5
-
sum15
TextWindow
.
Clear
(
)
TextWindow
.
WriteLine
(
"The answer is :"
+
answer
)
Copyright (c) Microsoft Corporation. All rights reserved.