Java Lab 7
Java Lab 7
Create a new Java file (empty Java file), save it to your H: drive, call it lab7
Insert the following code to set up your program:
import java.util.Scanner;
100pt:
Counts from 1 to 10
Counts down from 10 to 1
The user inputs an integer. The program will divide that number by two repeatedly until the
answer is 1. Your program output should appear as follows:
Input an integer:
>> 200
200 / 2 = 100
100 / 2 = 50
50 / 2 = 25
25 / 2 = 12
12 / 2 = 6
6 / 2 = 3
3 / 2 = 1
Notes:
For example:
int i = 1;
System.out.println(i);
i++;