' Basic
' For ... Next
dim yi as integer
dim n as integer
dim z as double
dim sum as double
dim zi as double
sum = 0
print "Введите n: "
input n
for yi = 1 to n
if ((yi > 15) or (yi < 0)) then
z = 2
else
z = yi
end if
zi = (sqr(z)-z)*(sqr(z)-z)
sum = sum + zi
next
print "Сумма = ", sum;
'-----------------------------------------------------------
' While Wend
dim yi as integer
dim n as integer
dim z as double
dim sum as double
dim zi as double
sum = 0
yi = -1
print "Введите n: "
input n
while (yi < n)
if ((yi > 15) or (yi < 0)) then
z = 2
else
z = yi
end if
zi = (sqr(z)-z)*(sqr(z)-z)
sum = sum + zi
yi = yi + 1
wend
print "Сумма =", sum;