0

I keep getting cannot find symbol variable i, when I run?? Also I have another posting that is up, how do I mark it as solved???

Here is the dilemma:

/**
Program to compute the first integral power to which 2 can be
raised that is greater than that multiple of a given integer.
*/
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
System.out.print("Please enter a number, 0 to quit: ");
int n = in.nextInt();
for (int i = 1; n * n > Math.pow(2,i); i++);
{
System.out.println("2 raised to " + i + " is the first power of two greater than " + n + " squared");
}
}
}

Edited by happygeek: fixed formatting

3
Contributors
3
Replies
4
Views
10 Years
Discussion Span
Last Post by peter_budo
0

check your loop. Why is there a semi-colon at the end of the line?
It's highly unlikely that it's supposed to be there.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.