Code help

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.

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
1
2
3
4
5
6
7
8
9
10
#include<iostream.h>
#include<conio.h>
#include<math.h>
void main()
{
	float k=sqrt(12000);
	for(int i=0;!(i>k);i++);
	cout<<i;
	getch();
}

I use Borland c++
This is what I got:

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;}
Last edited on
Topic archived. No new replies allowed.