Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
19
Task/Time-a-function/FreeBASIC/time-a-function.basic
Normal file
19
Task/Time-a-function/FreeBASIC/time-a-function.basic
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
' FB 1.05.0 Win64
|
||||
|
||||
Function sumToLimit(limit As UInteger) As UInteger
|
||||
Dim sum As UInteger = 0
|
||||
For i As UInteger = 1 To limit
|
||||
sum += i
|
||||
Next
|
||||
Return sum
|
||||
End Function
|
||||
|
||||
Dim As Double start = timer
|
||||
Dim limit As UInteger = 100000000
|
||||
Dim result As UInteger = sumToLimit(limit)
|
||||
Dim ms As UInteger = Int(1000 * (timer - start) + 0.5)
|
||||
Print "sumToLimit("; Str(limit); ") = "; result
|
||||
Print "took "; ms; " milliseconds to calculate"
|
||||
Print
|
||||
Print "Press any key to quit"
|
||||
Sleep
|
||||
Loading…
Add table
Add a link
Reference in a new issue