N
N
Nar Nar2020-07-13 14:08:15
C++ / C#
Nar Nar, 2020-07-13 14:08:15

How to find the eleventh element of the received array from the loop?

You need to find the eleventh element of the resulting array, which itself is divisible by 11, the sum of its digits is also equal to 11. but how to calculate the eleventh element in the end. what to put in the if block?

int[] a = Enumerable.Range(1, 1000).ToArray();
 for (int i = 0; i < a.Length; i++)
            {
                int o = a[i];
                s = o % 10 + (o - o % 10) / 10 % 10 + (o - o % 100) / 100;
                if (o%11 == 0 && s>=11 )
                {
                }
            }

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question