If you divide 1 by 2, you get 0.5. If you divide it again by 2, you get 0.25. Write a program that calculates and outputs the number of times you have to divide 1 by 2 to get a value less than one ten-thousandth (0.0001). Java program
public class NumDivisions {
public static void main(String[] args) {
int count = 0;
double num = 1;
while (num >= 0.0001) {
++count;
num /= 10;
}
System.out.println("Number of divisions to get a value less than 0.0001 is " + count);
}
}
