I can not understand the program, help!

In the array of positive and negative integers A [4,4], obtained randomly, calculate the sum of the elements of the secondary diagonal and the third column. If the sum of the elements of the side diagonal is greater than the sum of the elements of the third column, then select from the array all the numbers less than 25, and write them into a one-dimensional array, which is then sorted in ascending order. Otherwise, count the number of even numbers in array A and write it in place of the third element of the first sink.

Closed due to the fact that the essence of the issue is incomprehensible to the participants of Kromster , pavel , HamSter , Kirill Stoianov , cheops 1 Oct '16 at 6:56 .

Try to write more detailed questions. To get an answer, explain what exactly you see the problem, how to reproduce it, what you want to get as a result, etc. Give an example that clearly demonstrates the problem. If the question can be reformulated according to the rules set out in the certificate , edit it .

  • What exactly is not clear? To the words "If the sum of elements is by-product ..." is clear? If not, then on the basis of the words "the secondary diagonal is greater than the sum of the elements of the third column," it is probably necessary to count 2 sums (one diagonal and the other column). Now it is clear? - avp
  • 3
    @mikillskegg, why close training tasks? I do not call anyone to solve them. But to move the thoughts of the student in the right direction - what's wrong with that? - avp

1 answer 1

Hm In order:

The secondary diagonal is the diagonal from the southwest to the northeast. That is, from the bottom left corner to the top right. Calculated the sum of the items. Suppose it is equal to X.

The third column is the third column in Africa. The sum is Y.

X> Y : Pass through the entire array and write all the numbers that are less than 25 into a one-dimensional array. We sort the array so that at the beginning the numbers are small, and in the end - large.

X <= Y : We pass the entire array, count the number of even numbers - let's say Z. Write the value of Z in your array A , and specifically in the first row, third column.

  • one
    There are, of course, stupid tasks with incomprehensible conditions. But in this you just have to consider everything in order. In addition to the "side diagonal" :) - xEdelweiss