diff --git a/Ben Wortman/BW Lab-2.java b/Ben Wortman/BW Lab-2.java new file mode 100644 index 0000000..6623a79 --- /dev/null +++ b/Ben Wortman/BW Lab-2.java @@ -0,0 +1,26 @@ + + + + +public class Problem2{ + + int num = 1579; //starting number + System.out.println("The number is " + num); //says the starting number + + for(i=0; number>1; i++) //add one per loop + + {if (num % 2==0) //if the number is divisible by 2 is a whole number + { num = num/2; //then divide the number by 2 + System.out.println("The current number is " +num);} //prints number after divided by 2 + + else {num = num*3+1; //if not divisible by 2 multiply by 3 and add 1 + + System.out.println("The current number is " +num)}} //prints the number after multiplied by 3 and one added + + System.out.println("There were" +i " operations")} //prints how many times was a number sent through before it was 1 + + + + + +