The following program asks the user to repeatedly enter an input until the input is a perfect square (e.g., 0, 1, 4, 9,

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

The following program asks the user to repeatedly enter an input until the input is a perfect square (e.g., 0, 1, 4, 9,

Post by answerhappygod »

The following program asks the user to repeatedly enter an input
until the input is a perfect square (e.g., 0, 1, 4, 9, 16, 25,
etc.):
var b, i, x, n;
b = ??? ;
while (b==0){
x = prompt("Enter an integer that is a perfect
square");
n = Number(x);
for (i=0; i*i<=n; i++)
if (i*i==n)
b = 1;
}
What should be set as the initial value of b (in place of ???)
to make the program to work as the specified requirement?
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply