Advertisement
CrazyDiver

Cycles/Reamnants[G]

Dec 12th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.62 KB | None | 0 0
  1. var i,a,b,c,d,checker:integer;
  2. begin
  3.   readln(a,b);                          //read 1st 2 nums
  4.   readln(c,d);                          //read 2nd 2 nums
  5.   for i:=10000 to 99999 do              //iterate all 5-discharge nums
  6.     if (i mod a=b)and (i mod c=d) then  //if present num fits all condition demands then
  7.       begin
  8.         Write(i,' ');                   //write this num and space
  9.         checker:=1;                     //checker is 1
  10.       end;
  11.   if checker=0 then                     //if checker is 0 then there arent any nums, demand to cinditions and
  12.     writeln('-1');                      //wrtie -1
  13. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement