Var a, b, c, rez: real; begin write('Введите число А: '); readln(a); write('Введите число B: '); readln(b); write('Введите число C: '); readln(c); if (a >= 0) and (b >= 0) and (c >= 0) then rez := a + b + c; if (a >= 0) and (b >= 0) then rez := a + b; if (a >= 0) and (c >= 0) then rez := a + c; if (b >= 0) and (c >= 0) then rez := b + c; if (a <= 0) and (b <= 0) then rez := c; if (b <= 0) and (c <= 0) then rez := a; if (a <= 0) and (c <= 0) then rez := b; if (a <= 0) and (b <= 0) and (c <= 0) then rez := 0; writeln(rez); end.
//PascalABC.NET 3.1 сборка 1239 const n = 10; m = 10;
var i, j: integer; a, b: array[1..n, 1..m] of integer; f: boolean;
begin for i := 1 to n do begin for j := 1 to m do begin a[i, j] := random(50); write(a[i, j]:3, ' '); end; writeln; end; writeln;
for i := 1 to n do begin f := false; for j := 1 to m do begin if not f and (a[i, j] mod 2 = 1) then begin a[i, j] := 2 * a[i, j]; f := true; end; write(a[i, j]:3, ' '); end; writeln; end; end.
22
Объяснение:
Начало пути всегда 1 путь
А = 1
Сумма от входящих вершин (откуда идут стрелочки)
Б = А = 1
В = А + Б = 1 + 1 = 2
Г = А + В = 1 + 2 = 3
Д = Б + В = 1 + 2 = 3
Е = Д + В + Г = 3 + 2 + 3 = 8
Ж = Д + Е = 3 + 8 = 11
И = Е + Г = 8 + 3 = 11
К = Ж + И = 11 + 11 = 22