Code help please

I need help writing a loop function. I need to use a while loop to find the smallest integer (n) so that n*2 > 12,000.
(n*2 is exponential (pow function))
expl.

109 x 109 = 11881

110 x 110 = 12100

Therefore, 110 is the smallest value where n2 > 12000. But I need to use a loop to find the solution and I'm just not quite sure how to code this. Could someone please help me? Thanks in advance
Last edited on
Duuuuddee, you already made a topic here before and I already responded to it, anyways here's the code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
int main() {

	int number = 0;

	while (1==1) {
		
		if ((number*number) > 12000) {
			
			break;}

	number++;}

	cout<<"The number found was "<<number;

	return 0;}
What's up with all the pseudo-endless loops? After while comes the loop condition, not true or a variation thereof... :|

while (number*number<=12000)number++;
I think it's because I used to using while true from perl and python, because I would make pseudo-login things and I would use while loops in those things.

I think.

lawl
Topic archived. No new replies allowed.