Var s1,s2,c:string; i:integer; begin write('Type s1:'); readln(s1); write('Type s2:'); readln(s2); if length(s1)>length(s2) then begin for i:=1 to length(s1) do if (s1[i]>='0') and (s1[i]<='9') then write(s1[i]); writeln; for i:=1 to length(s2) do if ord(s2[i])>70 then write(s2[i]); end else begin for i:=1 to length(s1) do if ord(s1[i])>70 then write(s1[i]); writeln; for i:=1 to length(s2) do if (s2[i]>='0') and (s2[i]<='9') then write(s2[i]); end; end.
Пример ввода: Type s1:Mi Zu Type s2:MeL10N Пример вывода: MiZu 10
vgolentsova
19.07.2021
Function NOD(a, b: Integer): Integer; Var tmp, r: Integer; Begin If b > a Then Begin tmp := a; a := b; b := tmp; End; tmp := a; While tmp > 0 Do Begin Result := tmp; tmp := tmp - b; End; End;
Пример программы с использованием данной функции:
Program Example; Var a, b: Integer;
Function NOD(a, b: Integer): Integer; Var tmp, r: Integer; Begin If b > a Then Begin tmp := a; a := b; b := tmp; End; tmp := a; While tmp > 0 Do Begin Result := tmp; tmp := tmp - b; End; End;