Page 1 of 1

The following method is a recursive method. This method gets two integer numbers as its parameters(called num and factor

Posted: Mon Jul 11, 2022 9:54 am
by answerhappygod
The Following Method Is A Recursive Method This Method Gets Two Integer Numbers As Its Parameters Called Num And Factor 1
The Following Method Is A Recursive Method This Method Gets Two Integer Numbers As Its Parameters Called Num And Factor 1 (84.22 KiB) Viewed 34 times
The following method is a recursive method. This method gets two integer numbers as its parameters(called num and factor, then the method finds the biggest factor of the parameter num. The biggest factor of a number cannot be the number itself. for example the biggest factor of 12 is not 12 and it is 6. call mystery1(186,185) will display: The greatest factor is: 93 the call mystery1( 133, 132) will display: The greatest factor is: 19 The way the method works is: 133 % 132 is not zero, 133% 131 is not zero, 133% 130 is not zero, the process will continue until we get to 133 % 19 is zero then the recursive call ends. Note: if you need to enter for example a + 1, make sure to enter a, +, and 1 in the separate provided boxes. public static void mystery1(int num, int factor) { } if (factor > 0 && num % factor { 1 return mystery1 (num System.out.println("The greatest factor is: " + factor |); == factor 0 |);