Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Program Lab2_1;
- Uses
- System.SysUtils;
- Var
- Num : Integer;
- IsCorrect : Boolean;
- Sum : Integer;
- Begin
- Writeln('Данная задача находит бла бла бла');
- Repeat
- IsCorrect := True;
- Writeln('Введите Num');
- Try
- Readln(Num);
- Except
- IsCorrect := False;
- End;
- If ((Not IsCorrect) Or (Num < 1)) Then
- Begin
- IsCorrect := False;
- Writeln('Ошибка!');
- End;
- Until IsCorrect;
- Sum := 0;
- While (Num > 0) Do
- Begin
- Sum := Sum + (Num Mod 10);
- Num := Num Div 10;
- End;
- Writeln('Sum = ', Sum);
- Readln;
- End.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement