В столбце «Совпадения» указать с формул, какие числа равны, например в первой строке «Число В равно числу С». Как именно выглядит данная формула при написании?
program var s: string; a:array[1..4] of integer; i:integer; begin read(s); for i:=1 to 4 do a[i]:=0;
for i:=0 to length(s) do begin if s[i]=')' then inc(a[1]); if s[i]='(' then inc(a[2]); if s[i]='!' then inc(a[3]); if s[i]='.' then inc(a[4]); end;
if(a[1]>a[2])and(a[1]>a[3])and(a[1]>a[4]) then write('Funny')else if(a[2]>a[1])and(a[2]>a[3])and(a[2]>a[4]) then write('Sad') else if(a[3]>a[2])and(a[3]>a[1])and(a[3]>a[4]) then write('Angry') else if(a[4]>a[2])and(a[4]>a[3])and(a[4]>a[1]) then write('Deep') else write('Unclear');
Первая программа: program First_program; var i: longint; begin for i := 15 to 35 do begin if(i mod 2 = 0) then write(i, ' ') end;end.
Вторая программа: program Second_program; var i, h, g: integer; k: string; begin k := ''; for i := 1 to 20 do if i mod 2 = 0 then write(i, ' '); writeln; for i := 20 to 30 do if odd(i) then k := k + i + ','; g := length(k); for i := g downto g - 1 do if (k[i] = ',') then delete(k, i, 1); write(k)end.
Третья программа: program Third_program; var i, sum, proz: integer; begin sum := 0; proz := 1; for i := 1 to 10 do if (i mod 2 = 0) then sum := sum + i else proz := proz * i; writeln(sum); write(proz);end.
Четвертая программа: program Fourth_program; var i: longint; k: integer; begin k := 0; for i := 10 to 99 do if (i mod 2 = 0) and (i mod 3 = 0) then k := k + i; write(k)end.
var
s: string;
a:array[1..4] of integer;
i:integer;
begin
read(s);
for i:=1 to 4 do a[i]:=0;
for i:=0 to length(s) do
begin
if s[i]=')' then inc(a[1]);
if s[i]='(' then inc(a[2]);
if s[i]='!' then inc(a[3]);
if s[i]='.' then inc(a[4]);
end;
if(a[1]>a[2])and(a[1]>a[3])and(a[1]>a[4]) then write('Funny')else
if(a[2]>a[1])and(a[2]>a[3])and(a[2]>a[4]) then write('Sad') else
if(a[3]>a[2])and(a[3]>a[1])and(a[3]>a[4]) then write('Angry') else
if(a[4]>a[2])and(a[4]>a[3])and(a[4]>a[1]) then write('Deep') else
write('Unclear');
end.
program First_program;
var i: longint;
begin for i := 15 to 35 do begin if(i mod 2 = 0) then write(i, ' ') end;end.
Вторая программа:
program Second_program;
var i, h, g: integer; k: string;
begin k := ''; for i := 1 to 20 do if i mod 2 = 0 then write(i, ' '); writeln; for i := 20 to 30 do if odd(i) then k := k + i + ','; g := length(k); for i := g downto g - 1 do if (k[i] = ',') then delete(k, i, 1); write(k)end.
Третья программа:
program Third_program;
var i, sum, proz: integer;
begin sum := 0; proz := 1; for i := 1 to 10 do if (i mod 2 = 0) then sum := sum + i else proz := proz * i; writeln(sum); write(proz);end.
Четвертая программа:
program Fourth_program;
var i: longint; k: integer;
begin k := 0; for i := 10 to 99 do if (i mod 2 = 0) and (i mod 3 = 0) then k := k + i; write(k)end.