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
32
Task/Identity-matrix/FreeBASIC/identity-matrix.freebasic
Normal file
32
Task/Identity-matrix/FreeBASIC/identity-matrix.freebasic
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
' FB 1.05.0 Win64
|
||||
|
||||
Dim As Integer n
|
||||
|
||||
Do
|
||||
Input "Enter size of matrix "; n
|
||||
Loop Until n > 0
|
||||
|
||||
Dim identity(1 To n, 1 To n) As Integer '' all zero by default
|
||||
|
||||
' enter 1s in diagonal elements
|
||||
For i As Integer = 1 To n
|
||||
identity(i, i) = 1
|
||||
Next
|
||||
|
||||
' print identity matrix if n < 40
|
||||
Print
|
||||
|
||||
If n < 40 Then
|
||||
For i As Integer = 1 To n
|
||||
For j As Integer = 1 To n
|
||||
Print identity(i, j);
|
||||
Next j
|
||||
Print
|
||||
Next i
|
||||
Else
|
||||
Print "Matrix is too big to display on 80 column console"
|
||||
End If
|
||||
|
||||
Print
|
||||
Print "Press any key to quit"
|
||||
Sleep
|
||||
Loading…
Add table
Add a link
Reference in a new issue