SlepoiKrot

Untitled

Dec 28th, 2017
117
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. program A;
  2.  
  3. {$APPTYPE CONSOLE}
  4.  
  5. uses
  6. SysUtils;
  7. var
  8. m, n, i: integer;
  9. begin
  10. readln (n, m);
  11. i := 1;
  12. if (n = 0) or (m = 0) then begin
  13. writeln (0);
  14. exit;
  15. end;
  16. while (n <> m) do begin
  17. if (n > m) then
  18. n := n - m
  19. else
  20. m := m - n;
  21. inc (i);
  22. end;
  23. writeln (i);
  24. readln;
  25. readln;
  26. end.
RAW Paste Data