4.12(Finding the smallest n such that n 2 > 12000) Usea while loop to find the s
ID: 3613340 • Letter: 4
Question
4.12(Finding the smallest n such that n2 > 12000) Usea while loop to find the smallest integer n such that n2is greater that 12000.Please give me a hint . this is my code , but am i cannotcontinue.
#include <iostream>
using namespace std;
int main()
{
int count = 0 ;
int smallest = 0 ;
while(count <= 120)
{
if(count * count > 12000)
{
if(count < smallest)
{
smallest = count;
}
}
count++;
}
cout <<"The smallest n such that n square is >12000 is " << smallest <<" ";
system("pause");
return 0;
}
Explanation / Answer
please rate - thanks you're being much too complicated. the program should be #include<iostream>using namespace std; int main()
{ int main()
{ int count = 1;
while(count *count<=12000) { // your code here }
cout <<"The smallest n such that n square is > 12000 is "<< count <<" ";
system("pause");
return 0;
} }
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.