I need to Output the results of square root just for the whole numbers.
Example:
1 - 1
4 - 2
9 - 3
16 - 4...
up to 961 - 31
... Which is the last square root before 1000.
Until now I have this... But, this is showing square roots for all numbers until 1000, and I want the square root for WHOLE NUMBERS ONLY.
What should I do?
public class HelloWorld {
public static void main(String args[]) {
double i = 1;
do {
System.out.printf("%.0f\t%.0f\n", i, Math.sqrt(i));
i++;
} while (i <= 1000);
}
}
The output that I want should look like this: