Предмет: Информатика, автор: kirill94570

Помогите пожалуйста,последняя надежда(

Составить программу, которая формирует матрицу из n*n случайных чисел. Определить произведение чисел, лежащих на побочной диагонали матрицы. Значение n меняется в пределах от 5 до 10 тысяч.
Вариант 7
Pascal


nikniklas: размер n запрашивается у пользователя?
kirill94570: буква n=7
kirill94570: это номер варианта
kirill94570: или хз,все что знал,то и написал

Ответы

Автор ответа: nikniklas
1

Ответ:

const n=5;

var

   A:array[1..n,1..n] of integer;

   i,j:integer;

   proizv:real;

begin

   randomize;

   for i:=1 to n do

       for j:=1 to n do

           begin

               {число для рандома 10000-5+1 и потом увеличиваем на 5, т.е. от 5}        

               A[i,j]:=random(9996)+5;

           end;

   write('Исходная матрица A: ');

   for i:=1 to n do

       begin

           writeln;

           for j:=1 to n do

               write(A[i,j]:2,' ');

       end;

   proizv:=1;

   for i:=1 to n do

       proizv:=proizv*A[i,n+1-i];

   writeln;

   writeln('Произведение = ',proizv);

end.

Объяснение:

n - ставится в константе

Похожие вопросы
Предмет: Українська мова, автор: veronika1881
Предмет: Английский язык, автор: Los3344
Read the text and answer the question. More than one answer may be correct.
We spend about one-third of our lives sleeping, and when not dreaming, we аге completely without consciousness. Even the humble fruit fly sleeps while some creatures, such as dolphins, sleep with half their brain at а time. Sleep matters: go one night without it and we suffer the next day; go too long and we would die. As we fall asleep, the rapid electrical activity found in normal waking fades away and slow, deep waves start coursing throughout the cortex. Most sensory input is blocked and nerve signals to muscles are interrupted, preventing us from acting out our dreams. Despite this, the brain remains almost as active as when we are awake. Sleep is usually divided into three stages of increasing depth, plus the "rapid eye movement" (REM) stage in which brain activity is similar to waking and most dreams occur. There are many theories about why we sleep. Some researchers think sleep helps consolidate memories from the previous day. Others believe it rebalances neurotransmitter levels. Dreams are even more mysterious. Freud believed that they represent wish fulfillment of the subconscious. А more recent theory argues that they are just the brain making sense of its own activity when cut off from the world.
Dream consciousness is different from normal consciousness. When dreaming, we easily accept bizarre events, show reduced self-awareness, and generally lack experiences of volition. This may have to do with lower activity in the prefrontal cortex during dreaming. And dreaming is not limited to REM sleep – dream reports are also common after waking from early "slow wave" sleep, though these dreams are relatively static, snapshot-like images and usually lack а "self" character.
What happens when we fall asleep, according to the text?
1)The rapid electric activity is shifting deeper into the brain stem
2)The brain ignores most information coming from the periphery
3)Higher levels of neurotransmitters such as dopamine are being released
4)The cortex is experiencing slower electrical activity
5)Nerve signals cannot affect muscles
6)Brain shuts itself off from the rest of the body