Ask Me Help Desk

Ask Me Help Desk (https://www.askmehelpdesk.com/forum.php)
-   Java (https://www.askmehelpdesk.com/forumdisplay.php?f=440)
-   -   How to make a detailed GCD( greatest common divisor) java program. (https://www.askmehelpdesk.com/showthread.php?t=759201)

  • Jul 21, 2013, 07:46 AM
    kinnikuroy
    how to make a detailed GCD( greatest common divisor) java program.
    our professor wanted me to make a program regarding gcd of (a,b)

    I know it is easy but... our professor wanted an ouput exactly like this


    ex. Gcd (40, 23)
    OUTPUT:

    40 = 23(1) + (17) 0 <= 17 < 23
    23 = 17(1) + (6) 0 <= 6 < 17
    17 = 6(2) + (5) 0 <= 5 < 6
    6 = 5(1) + (1) 0 <= 1 < 5
    5 = 1(5) + (0) 0 <= 0 < 1

    thanks...
  • Jul 21, 2013, 02:32 PM
    kinnikuroy
    I mean this,

    40 = 23(1) + (17); 0 <= 17 < 23
    23 = 17(1) + (6) ; 0 <= 6 < 17
    17 = 6(2) + (5) ; 0 <= 5 < 6
    6 = 5(1) + (1) ; 0 <= 1 < 5
    5 = 1(5) + (0) ; 0 <= 0 < 1

  • All times are GMT -7. The time now is 07:32 PM.