Var k,x:integer;
begin
readln(x);
k:=0;
while x<>0 do begin
if x mod 2 = 0 then
k:=k+1;
readln(x);
end;
write(k);
readln
end.
Using System;
public class Test
{
public static void Main()
{
Console.Write("Введите координату х исходной точки (1-8): ");
int x1=Convert.ToInt32(Console.ReadLine());
Console.Write("Введите координату y исходной точки (1-8): ");
int y1=Convert.ToInt32(Console.ReadLine());
Console.Write("Введите координату х нужной точки (1-8): ");
int x=Convert.ToInt32(Console.ReadLine());
Console.Write("Введите координату y нужной точки (1-8): ");
int y=Convert.ToInt32(Console.ReadLine());
bool r=(Math.Abs(x-x1)*Math.Abs(y-y1)==2) &&
(x>0) && (x1>0) && (x<9) && (x1<9) &&
(y>0) && (y1>0) && (y<9) && (y1<9);
Console.WriteLine(r);
}
}
<u>Непосредственно условие:</u>
(Math.Abs(x-x1)*Math.Abs(y-y1)==2) &&
(x>0) && (x1>0) && (x<9) && (x1<9) &&
(y>0) && (y1>0) && (y<9) && (y1<9)
14-5 = 9
D-A = 2
(9+1)*(2+1) = 30 (+1 так ка включительно)
Ответ 30
// PascalABC.NET 3.3
begin
var a:=ArrRandom(35,2,42); a.Println;
Writeln('П=',a.Where(x->(x>=4)and(x<=10)).Aggregate(1,(p,x)->p*x));
end.
Пример:
34 16 9 17 4 11 34 26 30 17 28 18 6 31 38 20 30 35 29 40 21 38 30 10 5 9 15 12 28 5 23 6 30 30 37
П=2916000