WHILE LOOPS

 1) DEFINED LOOPS:-



   1) WHILE LOOP:-

   

    -While loop is called define loop

    -while loop is continuously execute the program as long as the condition is true.

    -looping is used to counter variable.

    -while loop also called as entry loop.



<html>

<head>

<script language="JavaScript">


var i=1;

while(i <=10)

{

document.write(i + "<br>"); 

i=i+1;  

}


</script>

</head>

</html>


que= write a program to display 1 to 10 even number  2,4,6,8,10,12,14,16,18,20


<html>

<head>

<script language="JavaScript">


  var i=2;

  while(i <=10)

{

  document.write(i);

  i=i+2;


}


</script>

</head>

</html>




que-2 

write a program to display 1 to 10 odd number.


<html>

<head>

<script language="JavaScript">


  var i=1;

  while(i <=10)

  {

  document.write(i);

  i=i+2;


  } yes sir 


</script>

</head>

</html>




Comments

Popular posts from this blog

HTML FORMS

condition management IF, ELSE, ELSEIF

HTML NOTES