38 lines
572 B
Plaintext
38 lines
572 B
Plaintext
' version 22-07-2017
|
|
' compile with: fbc -s console
|
|
|
|
Function f(n As Double) As Double
|
|
return Sqr(Abs(n)) + 5 * n ^ 3
|
|
End Function
|
|
|
|
' ------=< MAIN >=------
|
|
|
|
Dim As Double x, s(1 To 11)
|
|
Dim As Long i
|
|
|
|
For i = 1 To 11
|
|
Print Str(i);
|
|
Input " => ", s(i)
|
|
Next
|
|
|
|
Print
|
|
Print String(20,"-")
|
|
|
|
i -= 1
|
|
Do
|
|
Print "f(" + Str(s(i)) + ") = ";
|
|
x = f(s(i))
|
|
If x > 400 Then
|
|
Print "-=< overflow >=-"
|
|
Else
|
|
Print x
|
|
End If
|
|
i -= 1
|
|
Loop Until i < 1
|
|
|
|
' empty keyboard buffer
|
|
While InKey <> "" : Wend
|
|
Print : Print "hit any key to end program"
|
|
Sleep
|
|
End
|