java - calculating the gcd and lcm of 5 numbers -


How can I calculate the 5 numbers GCD and LCM which I should use a loop that I should make? ? This is what I had started to do but I think that I can start from the beginning in the wrong way can help anyone

  public static zero main (string [] Args) {// TODO auto generated method stub scanner input = new scanner (System.in); Int nbr1 = input.nextInt (); Int nbr2 = input.nextInt (); Int nbr3 = input.nextInt (); Int nbr4 = input.nextInt (); Int nbr5 = input.nextInt (); For (int i = nbr1; (i% nbr2 == 0 || i% nbr3 == 0 || I% nbr3 || i% nbr4 == 0 || i% nbr5 == 0; i ++) { }}}  

In order to calculate GCD for you, arrayOfInts and LCM of many numbers and possibly it can guide you better.


Comments

Popular posts from this blog

HTML/CSS - Automatically set height width from background image? -

php - Mysql Show Process - Sleep Commands and what to do -

c - What is the address of buf (the local variable in the main function)? -