Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /******************************************************************************
- Online Java Compiler.
- Code, Compile, Run and Debug java program online.
- Write your code in this editor and press "Run" button to execute it.
- *******************************************************************************/
- public class Main
- {
- public static int gcd(int a, int b)
- {
- if(a == 0)
- {
- System.out.println("Строка 15");
- return b;
- }
- if(b == 0)
- {
- System.out.println("Строка 21");
- return a;
- }
- if(a > 0 && b < 0 || a < 0 && b > 0)
- {
- System.out.println("Строка 27");
- b = -b;
- }
- do
- {
- System.out.println("Строка 33");
- if(a == b)
- {
- System.out.println("Строка 36");
- return a;
- }
- if(b > a && a > 0 || b < a && a < 0)
- {
- System.out.println("Строка 42");
- a = b - a;
- b = b - a;
- a = a + b;
- }
- System.out.println("Строка 48");
- b = a - b;
- a = a - b;
- }
- while(b != 0);
- System.out.println("Строка 54");
- return a;
- }
- public static void main(String[] args) {
- System.out.println(gcd(-1, 1));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement