Page 1 of 1

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

Posted: Wed Mar 30, 2022 9:17 am
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?