Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
|
|
@ -0,0 +1,42 @@
|
|||
' FB 1.05.0 Win64
|
||||
|
||||
Function Mean(array() As Double) As Double
|
||||
Dim length As Integer = Ubound(array) - Lbound(array) + 1
|
||||
If length = 0 Then
|
||||
Return 0.0/0.0 'NaN
|
||||
End If
|
||||
Dim As Double sum = 0.0
|
||||
For i As Integer = LBound(array) To UBound(array)
|
||||
sum += array(i)
|
||||
Next
|
||||
Return sum/length
|
||||
End Function
|
||||
|
||||
Function IsNaN(number As Double) As Boolean
|
||||
Return Str(number) = "-1.#IND" ' NaN as a string in FB
|
||||
End Function
|
||||
|
||||
Dim As Integer n, i
|
||||
Dim As Double num
|
||||
Print "Sample input and output"
|
||||
Print
|
||||
Do
|
||||
Input "How many numbers are to be input ? : ", n
|
||||
Loop Until n > 0
|
||||
Dim vector(1 To N) As Double
|
||||
Print
|
||||
For i = 1 to n
|
||||
Print " Number #"; i; " : ";
|
||||
Input "", vector(i)
|
||||
Next
|
||||
Print
|
||||
Print "Mean is"; Mean(vector())
|
||||
Print
|
||||
Erase vector
|
||||
num = Mean(vector())
|
||||
If IsNaN(num) Then
|
||||
Print "After clearing the vector, the mean is 'NaN'"
|
||||
End If
|
||||
Print
|
||||
Print "Press any key to quit the program"
|
||||
Sleep
|
||||
Loading…
Add table
Add a link
Reference in a new issue