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");
}
}
}

Recommended Answers

All 3 Replies

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.

Thank you very much. How do I make this post as solved??

next to your first post is button/link Solved....

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.