Using System;
class Program
static void Main()
{
int n = 5;
int m = 10;
var a = new Int32[n, m];
int imin = 0;
int imax = 0;
int max = 0;
int min = 100;
var random = new Random();
for (var i = 0; i < a.GetLength(0); i++, Console.WriteLine())
for (var j = 0; j < a.GetLength(1); j++)
{
a[i, j] = random.Next(100);
if (max < a[i, j])
{
max = a[i, j];
imax = j;
}
if (min > a[i, j])
{
min = a[i, j];
imin = j;
}
Console.Write("{0,4}", a[i, j]);
}
if (imin == imax)
Console.WriteLine("Элементы находятся в одном столбце");
else
{
Console.WriteLine();
for (int i = 0; i < a.GetLength(0) -1; i++)
for (int j = i + 1; j < a.GetLength(0); j++)
if (a[i,imin] > a[j, imin])
{
var temp = a[i, imin];
a[i, imin] = a[j, imin];
a[j, imin] = temp;
}
for (int i = a.GetLength(0) - 2; i >=0 ; i--)
for (int j = i; j < a.GetLength(0)-1; j++)
if (a[j, imax] < a[j+1, imax])
{
var temp = a[i, imin];
a[j, imax] = a[j+1, imax];
a[j + 1, imax] = temp;
}
for (var i = 0; i < a.GetLength(0); i++, Console.WriteLine())
for (var j = 0; j < a.GetLength(1); j++)
Console.Write("{0,4}", a[i, j]);
}
Console.Read();
}
}
===== PascalABC.NET =====
begin
var n := ReadInteger('n =');
var A := ArrRandom(n, -99, 99);
A.Println;
var B := ArrRandom(n, -99, 99);
B.Println;
var s := (A + B).AsEnumerable;
Write('Min = ', s.Min, ', max = ', s.Max)
end.
Объяснение:
Код:
program storinka29zadacha7;
uses crt;
const g=9.80665;
var e,m,v,p,h:real;
begin
writeln('Vvedite m');
readln(m);
writeln('Vvedite v');
readln(v);
writeln('Vvedite h');
readln(h);
e:=m*sqr(v)*8/2;
p:=m*g*h;
writeln('E=',e);
writeln('P=',p);
end.
Схема на картинке