На языке Паскаль. Заполнить матрицу случайными числами. Размерность и диапазон генерации ввести с клавиатуры. Вычислить произвед
На языке Паскаль. Заполнить матрицу случайными числами. Размерность и диапазон генерации ввести с клавиатуры. Вычислить произведение элементов массива, лежащих вне главной диагонали.
Program primer; procedure random(c,x,y:integer; var r:integer); begin case c of 1 : r:=Random(ABS(Y)+ABS(x)+1)+x; 2 : r:=Random(ABS(Y)+ABS(x)+1)+y; 3 : r:=Random(Y-x+1)+x; 4 : r:=Random(x-y+1)+y; 5 : r:=Random(x+y); 6 : r:=Random(ABS(x+y))-ABS(x+y); 7 : r:=x; 8 : r:=Random(ABS(ABS(x)-ABS(y)))-ABS(x); 9 : r:=Random(ABS(ABS(x)-ABS(y)))-ABS(y); end; end; var a: array of array of integer; i,j,x,y,m,p,pro,c:integer; begin Randomize; pro:=1; writeln('Кол-во строк и столбцов массива? //X,Y\\ '); read(i,j); //Размерность массива writeln('Диапазон чисел //от X,до Y\\ '); read(x,y); //и диапазон генерации вводятся с клавиатуры. if (x=y) then c:=7 else if(x<0) and (y<0) then if (x<y) then c:=8 else c:=9 else if (x=0) or (y=0) then if(x<0) or (y<0) then c:=6 else c:=5 else if(x<0) or (y<0) then if (x<y) then c:=1 else c:=2 else if (x<y) then c:=3 else c:=4; SetLength(a,i); for m:=0 to i-1 do SetLength(a[m],j);<span> </span> for m:=0 to i-1 do begin writeln(); for p:=0 to j-1 do begin random(c,x,y,a[m,p]); {Заполнить матрицу случайными числами<span>} </span> if (m<>p) then pro:=pro*a[m,p]; {<span>Вычислить произведение элементов массива, лежащих вне главной диагонали.}</span> write (a[m,p]:3,' ':3); end; <span> end; </span>
Program time ; Var t : Integer; Begin WriteLn ('Введите время'); ReadLn (t) ; If (t>=0) and (t<6) then WriteLn ('Ночь') ; If (t>=6) and (t<12) then WriteLn ('Утро') ; If (t>=12) and (t<18) then WriteLn ('День') ; If (t>=18) and (t<24) then WriteLn ('Вечер') ; End.