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

посчитать сумму элементов находящихся на главной диагонали.
Паскаль

Ответы

Автор ответа: Аноним
0
// PascalABC.NET 3.1, сборка 1179 от 29.02.2016
begin
  var n:=ReadInteger('n=');
  var a:=MatrixRandom(n,n,-50,50);
  var s:=0;
  for var i:=0 to n-1 do begin
    for var j:=0 to n-1 do Write(a[i,j]:4);
    s+=a[i,i];
    Writeln
    end;
  Writeln('S=',s)    
end.

Тестовое решение:
n= 5
   8  34   3  -6  22
  46   1   3 -19  11
  41  16 -41  -6 -30
  46  37  30 -48  -6
  33  14   8  42  13
S=-67
Похожие вопросы
Предмет: Английский язык, автор: Alonzo8987
№1. fossil fuels, footpath, special offer, unpredictable, extinct, global warming, youth, freezing, competitors, rise

1. There’s a __________ on flights to France this month.


2. It’s ________ cold today.


3. The burning of ________ produces carbon dioxide.


4. The weather is __________. You never know what to wear.


5. Many animals may become _______.


6. ________ is causing ice to melt and temperatures to ______ .


7. One of the _______ broke his leg in the wok racing.


8. We stayed in ______ hostel for a week.


9. Follow the __________ and you will find the camp.




№2. Choose the preposition.


1. Many animals are in/ under threat.


2. They adapted to/ in the dark conditions.


3. He was singing loudly to scare by/ off bears.


4. Wear more clothes instead of turning off/ up the heat.


5. They warned me about/ of his bad behavior.



№3. Word formation. Fill in the correct word derived from the words in CAPITALS.


1. Extreme sports like roofing are ___________. (DANGER)


2. She looks ________ . (ATHLETE)


3. The salad is very ________ . (SALT)


4. This hotel is very _______. (EXPENSE)


5. Enjoy this ____ beauty. (NATURE)


6. Scientists say robots could be rather ____ in the future. (FUNCTION)


7. I like to travel with him by car. He is a very _____ driver. (CARE)


8. The sofa looks _______. I’d like to buy it. (COMFORT)


9. I’m _____ to oranges. That’s why I avoid eating them. (ALLERGY)




№4. Choose the correct item.


1. I promise I ____ to the library after school.


a) am going b) will go c) go


2. Tom _____ on a trip this weekend.


a) going to go b) is going c) goes


3. My train _______ at 9:00 tomorrow.


a) leaves b) will leave c) is leaving


4. We _____ dinner at a restaurant at 7p.m. I booked a table yesterday.


a) have b) will have c) are having


5. Don’t worry. I _____ you to do the task.


a) help b) am helping c) will help


6. If you heat water, it ______


a) boils b) will boil c) boil


7. If you study hard, you ____ the exam.


a) would pass b) would have passed c) will pass




№5. Communication. Match 1-6 to A-F.


1. How can I help you?

2. Can I book it, please?


3. Does that include breakfast?


4. How much is it per night?


5. How about joining me for a game?


6. We look forward to seeing you.


A. Thank you. Goodbye.


B. It’s 100 $


C. I’d like to book a room, please.


D. Sure, I’d love to!


E. Certainly. When for?


F. No, I’m sorry.
Предмет: Информатика, автор: azarmedetova