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

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

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

Post 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 32 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 |);
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply