Saturday, 14 September 2024

WRITE A JAVASCRIPT TO PRINT 1 TO 10 USING DO WHILE LOOP

 

CODE :-

<html>

                <head>

                                <title>Do While Loop</title>

                                <script type="text/javascript">

                                                function check()

                                                {

                                                                var no=10,i=1;

                                                                do

                                                                {

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

                                                                                i++;

                                                                }

                                                                while(i<=no);

                                                }

                                </script>

                </head>

                <body>

                                <form name="form1" method="post">

                                                <input type="button" name="sub" value="click me" onclick="return check()">

                                </form>

                </body>

</html>

No comments:

Post a Comment