Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Program L2_2_D;
- Uses System.SysUtils;
- Var
- IsCorrect : Boolean;
- P, Result : Integer;
- Function RemoveZerosFromNumber(Num: Integer): Integer;
- Var
- Multiplier : Integer;
- Begin
- Result := 0;
- Multiplier := 1;
- While Num > 0 Do
- Begin
- If Num Mod 10 <> 0 Then
- Begin
- Result := Result + (Num mod 10) * Multiplier;
- Multiplier := Multiplier * 10;
- End;
- Num := Num div 10;
- End;
- Result := Result;
- End;
- Begin
- Repeat
- IsCorrect := True;
- Write('Введите натуральное число P: ');
- Try
- Readln(P);
- Except
- Writeln('Неверный тип данных');
- IsCorrect := False;
- End;
- Until IsCorrect;
- Result := RemoveZerosFromNumber(P);
- Writeln(Result);
- Readln;
- End.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement