Write java IF statement that prints true if both x and y are positive numbers. 3. If
Fantastic news! We've Found the answer you've been seeking!
Question:
Write java IF statement that prints true if both x and y are positive numbers.
3. If integer variable currentNumber is odd, change its value so that it is now 3
times currentNumber plus 1, otherwise change its value so that it is now half of
currentNumber.
int currentNumber = 12;
if(currentNumber%2==1){
currentNumber = currentNumber*3+1;
}
else
currentNumber = currentNumber/2;
Related Book For
Discrete Mathematics and Its Applications
ISBN: 978-0073383095
7th edition
Authors: Kenneth H. Rosen
Posted Date: