Microsoft QBasic 1.0
DIM x AS DOUBLE, a AS DOUBLE, b AS DOUBLE, h AS DOUBLE
CLS
INPUT "a=", a
INPUT "b=", b
INPUT "h=", h
FOR x = a TO b + h / 2 STEP h
IF ABS(x) <= 1 THEN<br> y = 1 / x * x + 1
ELSE
y = x ^ 3 - 5
END IF
PRINT x, y
NEXT x
Пример
a=0.5
b=6
h=0.25
.5 2
.75 2
1 2
1.25 -3.046875
1.5 -1.625
1.75 .359375
2 3
2.25 6.390625
2.5 10.625
2.75 15.79688
3 22
3.25 29.32813
3.5 37.875
3.75 47.73438
4 59
4.25 71.76563
4.5 86.125
4.75 102.1719
5 120
5.25 139.7031
5.5 161.375
5.75 185.1094
6 211