Var a: Array[1..30,1..30] of Integer; n,min, max, i,j,s: Integer; BEGIN writeln('n='); readln(n); Randomize; Writeln('sluciayniy massiv:'); For i:=1 to n do begin For j:=1 to n do begin a[i,j]:=Random(51)-25; Write(a[i,j]:5); end; Writeln; end; s:=0; min:= a[1,1]; max:= a[1,1]; for i:= 1 to n do for j:= 1 to n do if a[i,j]<min then min := a[i,j]; for i:= 1 to n do for j:= 1 to n do if a[i,j]> max then max:= a [i,j]; for i:=1 to n do for j:= 1 to n do if i=j then s:= s+a[i,j]; writeln('min=',min, ' max=',max,' summa elementov glavnoi dioganali=',s); readln; end.
Var a: Array[1..100,1..100] of Integer; n,min, max, i,j,s:Integer; BEGIN writeln('n='); readln(n);
Writeln('vvedite massiv:'); For i:=1 to n do begin For j:=1 to n do begin read(a[i,j]); end; Writeln; end; s:=0; min:= a[1,1]; max:= a[1,1]; for i:= 1 to n do for j:= 1 to n do if a[i,j]<min then min := a[i,j]; {поиск минимального элемента } for i:= 1 to n do for j:= 1 to n do if a[i,j]> max then max:= a [i,j]; {поиск максимального элемента} for i:=1 to n do for j:= 1 to n do if i=j then s:= s+a[i,j]; { поиск элементов главной диагонали и нахождение их суммы} writeln('min=',min, ' max=',max,' summa elementov glavnoi dioganali=',s); readln; end.
Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles MyBase.Load Dim s(9) As String Dim b As Boolean TextBox1.Multiline = True TextBox1.Height = 100 For i = 1 To 9 s(i) = InputBox("Введите элемент " & i) If s(i) = "0" Then b = True Next For i = 1 To 9 If b Then s(i) = "7" Next For i = 1 To 9 TextBox1.Text = TextBox1.Text & s(i) & Chr(32) If i = 3 Or i = 6 Then _ TextBox1.Text = TextBox1.Text & vbCrLf Next End Sub End Class
работает в Visual Studio 2010 (не думаю, что вы в VB6 пишите) перед запуском, киньте на форму TextBox