Перевод с языка Pascal на C#: Заменить все члены, следующие за членом с наибольшим значением - C# (184388)
Формулировка задачи:
Program n1; Uses Crt; var a: array[1..30,1..30] of integer; k,m,i,j,s: integer; begin for i:=1 to 18 do begin for j:=1 to 12 do begin a[i,j]:=random(5001)+5000; write(a[i,j]:6); end; writeln; end; writeln; s:=0; for i:=1 to 18 do s:=s+a[i,6]; writeln(‘Summa: ‘, s); end.
Решение задачи: «Перевод с языка Pascal на C#: Заменить все члены, следующие за членом с наибольшим значением»
textual
Листинг программы
using System;
namespace ConsoleApplication1
{
class Program
{
static Random rnd = new Random();
static void Main(string[] args)
{
int[,] a = new int[30, 30];
for(int i = 0; i < 18; i++)
{
for(int j = 0; j < 12; j++)
{
a[i, j] = rnd.Next(5000, 10000);
Console.WriteLine(a[i, j]);
}
Console.WriteLine();
}
Console.WriteLine();
int s = 0;
for (int i = 0; i < 18; i++)
s = s + a[i, 6];
Console.WriteLine("Summa: {0}", s);
Console.ReadKey();
}
}
}