Нужны комментарии к коду - C# (191523)
Формулировка задачи:
Объясните мне все по порядку, каждую строку, если не сложно)
const int n = 8;
int [] a = new int [n];
Random rnd = new Random();
for (int i = 0; i<n; i++) {
a[i] = rnd.next(20);
console.write("{0,4}", a[i]);
}
console.writeLine();
array.Sort(a);
for (int i = 0; i<n; i++)
console.write("{0,4}",a[i]);
Console.WriteLine();
Array.Reverse(a);
for (int i=0; i<n; i++)
console.Write("{0,4}",a[i]);Решение задачи: «Нужны комментарии к коду»
textual
Листинг программы
const int n = 8;
int[] a = new int[n];
Random rnd = new Random();
for (int i = 0; i < n; i++)
{
a[i] = rnd.Next(20);
Console.Write("{0,4}", a[i]);
}
Console.WriteLine();
Array.Sort(a);
for (int i = 0; i < n; i++)
Console.Write("{0,4}", a[i]);
Console.WriteLine();
Array.Reverse(a);
for (int i = 0; i < n; i++)
Console.Write("{0,4}", a[i]);
Console.ReadLine();