Jater

Fedya_for

Nov 29th, 2012
77
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. {b) Дано натуральное число n.  
  2. Получить все натуральные числа,
  3. меньшие n и взаимно простые с ним.}
  4. var n,i,c,x,y,z,nod:integer;
  5. begin
  6.     write('n=');
  7.     readln(n);
  8.     c:=0;
  9.     for i:=2 to n-1 do
  10.     begin
  11.         y:=n;x:=i;
  12.         if(x<y)then
  13.         begin
  14.             x:=x+y;
  15.             y:=x-y;
  16.             x:=x-y;
  17.         end;
  18.         while(x mod y <>0) do
  19.         begin
  20.             z:=x;
  21.             x:=y;
  22.             y:=z mod y;
  23.         end;
  24.         if(y=1)then
  25.         begin
  26.             write(i:5);
  27.             c:=c+1;
  28.         end;
  29.     end;
  30.     if c=0 then write('net vzaimoprostich chisel');
  31.     readln;
  32. end.
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×