Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- procedure VvodCh(var a, b: longint);
- begin
- readln(a, b); //read 2 nums
- end;
- function CheckDivOnDshcs(inp: longint): boolean;
- var
- cop_inp: longint;
- res: boolean;
- begin
- cop_inp := inp; //copy inputted val
- res := true; //assign to the logic var true value
- while (cop_inp > 0) and res do //repeat cycle if copied val more than 0 and res is 1
- begin
- if (cop_inp mod 10) <> 0 then //if copied num isnt ends wth 0 then
- res := (inp mod (cop_inp mod 10)) = 0 //res is 1 if division and getting remainder inputted num on last discharge of copied val isnt 0
- else //else
- res := false; //logic var eq 0
- cop_inp := cop_inp div 10; //cut las discharge of copied num
- end;
- CheckDivOnDshcs := res; //assign to the res of func last vaalue of logic var
- end;
- procedure WriteNumsAccordLogicF(a, b: longint);
- var
- i: longint;
- begin
- for i := a to b do //iterate all nums in range from a to b
- if CheckDivOnDshcs(i) then //if num approach all logic func demands then
- write(' ', i); //write space and this num
- end;
- var
- a, b: longint;
- begin
- VvodCh(a, b); //read 2 nums
- WriteNumsAccordLogicF(a, b); //write nums in range if then approach logic func demands
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement