|
zadach152.BAS |
|
{* Задача152 *}REM basic ' Вычислить сумму двух заданных матриц размером 3*3.CLS
n=3
Dim a(n,n)
Dim b(n,n)
RANDOMIZE TIMER
For i=1 To n
For j=1 To n
a(i,j)=INT(RND*101)-50
b(i,j)=INT(RND*101)-50
Next j
Next i
PRINT "Matrica A"
For i=1 To n
For j=1 To n
PRINT a(i,j);
Next j
PRINT
Next i
PRINT
PRINT "Matrica B"
For i=1 To n
For j=1 To n
PRINT b(i,j);
Next j
PRINT
Next i
PRINT
Dim s(n,n)
For i=1 To n
For j=1 To n
s(i,j)=a(i,j)+b(i,j)
Next j
Next i
PRINT "Summa matric"
For i=1 To n
For j=1 To n
PRINT s(i,j);
Next j
PRINT
Next i
End
|