1)const nmax=50; mmax=50; var x:array [1..nmax, 1..mmax] of integer; n,m,i,j,ki: integer; begin write('Введите размерность матрицы: '); readln(n,m); writeln('Введите элементы матрицы: '); for i:=1 to n do for j:=1 to m do readln(x[i,j]); writeln('Матрица: '); for i:=1 to n do begin for j:=1 to m do write(x[i,j]); writeln(' '); end; j:=1; while (j<=m) do begin ki:=0; for i:=1 to n do if (x[i,j] mod 2 =0) then ki:=ki+1; writeln('В столбце',j,': ',ki,' чётных элементов'); j:=j+2; end; end. 2)for i:=1 to 5 do beginfor j:=1 to 5 do begin ... if (j mod 2=0) and (a[i,j]>0) then s:=s+a[i]; ... 3)int[,] mass = new int[5,6];for(int i=0;i<5;i++) { for(int j=0;j<6;j++) mass[i,j]=Convert.ToInt32(Console.ReadLine()); } int [] mass2 =new int[6]; int c=0; for(int i=0;i<6;i++) { mass2[c]=1; for(int j=0;j<5;j++) {if(mass[j,i]%2==0&&mass[i,j]>0) mass2[c]*=mass[j,i]} c++; } for(int i=0;i<6;i++) { Console.WriteLine(mass2[i]); } Console.ReadLine();
Function Bin(s As String, z As Integer) As String Dim c As Integer Dim oct As Integer c = Val(s) Do oc = c Mod 2 c = c \ 2 Bin = Bin & Str(oc) Loop Until c = 0 Bin = StrReverse(Bin) If z = -1 Then Bin = "-" & Bin End Function
Sub z() Dim s As String, s1 As String Dim n As Integer, i As Integer, z As Integer Dim max s = InputBox("Введите строку: ") max = Null i = 1 Do While i <= Len(s) Select Case Mid(s, i, 1) Case 0 To 9 If z = 0 And i > 1 Then z = IIf(Mid(s, i - 1, 1) = "-", -1, 1) Else: z = 1 End If s1 = s1 + Mid(s, i, 1) If i = Len(s) Then GoSub 1 Case Else: If s1 <> "" Then GoSub 1 End Select i = i + 1 Loop MsgBox ("max=" & max) End 1: n = z * Val(s1) MsgBox (n & "; двоичная форма: " & Bin(s1, z)) If IsNull(max) Then max = n If max < n Then max = n z = 0 s1 = "" Return End Sub
2)for i:=1 to 5 do beginfor j:=1 to 5 do begin ... if (j mod 2=0) and (a[i,j]>0) then s:=s+a[i]; ...
3)int[,] mass = new int[5,6];for(int i=0;i<5;i++) { for(int j=0;j<6;j++) mass[i,j]=Convert.ToInt32(Console.ReadLine()); } int [] mass2 =new int[6]; int c=0; for(int i=0;i<6;i++) { mass2[c]=1; for(int j=0;j<5;j++) {if(mass[j,i]%2==0&&mass[i,j]>0) mass2[c]*=mass[j,i]} c++; } for(int i=0;i<6;i++) { Console.WriteLine(mass2[i]); } Console.ReadLine();
Function Bin(s As String, z As Integer) As String
Dim c As Integer
Dim oct As Integer
c = Val(s)
Do
oc = c Mod 2
c = c \ 2
Bin = Bin & Str(oc)
Loop Until c = 0
Bin = StrReverse(Bin)
If z = -1 Then Bin = "-" & Bin
End Function
Sub z()
Dim s As String, s1 As String
Dim n As Integer, i As Integer, z As Integer
Dim max
s = InputBox("Введите строку: ")
max = Null
i = 1
Do While i <= Len(s)
Select Case Mid(s, i, 1)
Case 0 To 9
If z = 0 And i > 1 Then
z = IIf(Mid(s, i - 1, 1) = "-", -1, 1)
Else: z = 1
End If
s1 = s1 + Mid(s, i, 1)
If i = Len(s) Then GoSub 1
Case Else:
If s1 <> "" Then GoSub 1
End Select
i = i + 1
Loop
MsgBox ("max=" & max)
End
1: n = z * Val(s1)
MsgBox (n & "; двоичная форма: " & Bin(s1, z))
If IsNull(max) Then max = n
If max < n Then max = n
z = 0
s1 = ""
Return
End Sub