a:array[0..9] of integer;
i,y,min:integer;
begin
randomize();
for i:=0 to 9 do
begin
y:= random(10);
a[i]:= y;
end;
for i:=0 to 9 do write(a[i],' ');
writeln(' - десять випадковых чисел');
min:=a[0];
for i:=1 to 9 do
if a[i]<min then min:=a[i];
writeln(min, ' - минимальне число.');
end.
Код:
using System;
namespace WordsCounter
{
class Bishop
{
private int x, y;
public Bishop(int x, int y)
{
this.x = x;
this.y = y;
}
public bool CanIAttackIt(int x, int y)
{
return Math.Abs(x - y) == Math.Abs(this.x - this.y);
}
}
class Program
{
static void Main(string[] args)
{
var x0 = int.Parse(Console.ReadLine()!);
var y0 = int.Parse(Console.ReadLine()!);
var x = int.Parse(Console.ReadLine()!);
var y = int.Parse(Console.ReadLine()!);
Console.WriteLine((new Bishop(x0, y0)).CanIAttackIt(x, y));
}
}
}

