Var a, b, c, r : integer;
begin
c:=0;
r:=9;
write('Введите число: ');
readln(a);
while a div 10 <> 0 do
begin
b:=a mod 10;
a:=a div 10;
if b>c then c:=b;
if b<r then r:=b;
end;
b:=a mod 10;
a:=a div 10;
if b>c then c:=b;
if b<r then r:=b;
writeln('Разность: ', c-r);
end.
ДА ХОТЬ ДЛЯ 10 ЗНАЧНОГО))))
Это пользователь... тыдым с:
Using System;
namespace Cars{ public enum Direction { Left, Right }
public class TurnEventArgs : EventArgs { public TurnEventArgs(Direction direction) { Direction = direction; }
public Direction Direction { get; } }
public abstract class Car { public event EventHandler Started; public event EventHandler Stopped; public event EventHandler<TurnEventArgs> Turned;
public int Speed { get; set; } public string Color { get; set; } public string Name { get; set; } public virtual bool IsPolice => false;
public void Go() { Started?.Invoke(this, EventArgs.Empty); }
public void Stop() { Stopped?.Invoke(this, EventArgs.Empty); }
public void Turn(Direction direction) { Turned?.Invoke(this, new TurnEventArgs(direction)); } }
public class TownCar : Car { }
public class SportCar : Car { }
public class WorkCar : Car { }
public class PoliceCar : Car { public override bool IsPolice => true; }}
Радиограмма расшифровывается однозначно: УЖАТАХТ
Получать слова можно по-разному. Самое простое - собирать их по буквам:
var st1,st2:string[10];
begin
readln(st1);
st1:='клавиатура';
st2:=st1[7]+st1[8]+st1[9];
writeln(st2);
st2:=st1[9]+st1[8]+st1[1]+st1[3];
writeln(st2);
st2:=st1[2]+st1[3]+st1[4]+st1[1]+st1[3];
writeln(st2);
st2:=st1[4]+st1[3]+st1[7]+st1[10];
writeln(st2);
end.
Результат:
тур
рука
лавка
вата