RosettaCodeData/Task/Trabb-Pardo-Knuth-algorithm/FreeBASIC/trabb-pardo-knuth-algorithm...

36 lines
565 B
Plaintext

' version 22-10-2016
' compile with: fbc -s console
Function f(n As Double) As Double
return Sqr(Abs(n)) + 5 * n ^ 5
End Function
' ------=< MAIN >=------
Dim As Double x, s(0 To 10)
Dim As Long i
For i = 0 To 10
Print Str(i);
Input " => ", s(i)
Next
Print
Print String(20,"-")
For i = 10 To 0 Step -1
Print "f(" + Str(s(i)) + ") = ";
x = f(s(i))
If x > 400 Then
Print "-=< to large >=-"
Else
Print x
End If
Next
' empty keyboard buffer
While InKey <> "" : Wend
Print : Print "hit any key to end program"
Sleep
End