Advertisement
DimaT1

Untitled

Dec 9th, 2019
325
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.56 KB | None | 0 0
  1. /******************************************************************************
  2.  
  3. Online Java Compiler.
  4. Code, Compile, Run and Debug java program online.
  5. Write your code in this editor and press "Run" button to execute it.
  6.  
  7. *******************************************************************************/
  8.  
  9. public class Main
  10. {
  11. public static int gcd(int a, int b)
  12. {
  13. if(a == 0)
  14. {
  15. System.out.println("Строка 15");
  16. return b;
  17. }
  18.  
  19. if(b == 0)
  20. {
  21. System.out.println("Строка 21");
  22. return a;
  23. }
  24.  
  25. if(a > 0 && b < 0 || a < 0 && b > 0)
  26. {
  27. System.out.println("Строка 27");
  28. b = -b;
  29. }
  30.  
  31. do
  32. {
  33. System.out.println("Строка 33");
  34. if(a == b)
  35. {
  36. System.out.println("Строка 36");
  37. return a;
  38. }
  39.  
  40. if(b > a && a > 0 || b < a && a < 0)
  41. {
  42. System.out.println("Строка 42");
  43. a = b - a;
  44. b = b - a;
  45. a = a + b;
  46. }
  47.  
  48. System.out.println("Строка 48");
  49. b = a - b;
  50. a = a - b;
  51. }
  52. while(b != 0);
  53.  
  54. System.out.println("Строка 54");
  55. return a;
  56. }
  57. public static void main(String[] args) {
  58. System.out.println(gcd(-1, 1));
  59. }
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement