Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Main Page Problems Solve a Problem gcd> Show Header O BJP3 Exercise 5.1: showTwo

ID: 3904097 • Letter: M

Question

Main Page Problems Solve a Problem gcd> Show Header O BJP3 Exercise 5.1: showTwos Favorite Language/Type: i Java while loops method basics mod Author: Leslie Ferguson (on 2013/04/01) Write a method named showTwos that shows the factors of 2 in a given integer. For example, the following calls showTwos (7); showTwos (18); showTwos (68) showTwos (120); should produce this output: 182 9 682217 120222 15 Type your solution here: 4 6 7 8 This is a method problem. Write a Java method as described. Do not write a complete program or class; just the method(s) above E4 Indent Sound FIX a Highlighting y Submit

Explanation / Answer

count=0;

showTwos(n)

{

if(n%2==0)

{

r=n/2;

n=r;

count++;

}

s=(2^count)*n;

System.out.println("the result is":,n);

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote