Advertisements
Advertisements
Question
Write a Java Script program using while statement to display 10 numbers.
Long Answer
Solution
<html>
<Head>
<Title> Display 10 Numbers in Javascript</Title>
</Head>
<Body>
<script language = “java script” type = “text / java script”>
document.write (“<h2> using while statement </h2>”)
Var no2= 0;
while (no2<=10)
{
document.write (no2+ “ ”);
no2=no2+1;
}
</script>
</body>
</html>
shaalaa.com
Looping / Repetitive
Is there an error in this question or solution?
APPEARS IN
RELATED QUESTIONS
Which of the following is not a looping statement?
Which part of the loop statement determines the number of times, the loop will be iterated?
In the _____ loop, body of the loop always executed at least once before the condition can be executed.
What is called a loop and what are its types?
Differentiate between while and do while statements.
Explain for loop with example.