Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 90 - 2625 PortGPt V2.1
P. 90

    Program 6: To check if the given number is lucky or not, if the given number is greater than zero
                       and is even, then print ‘Lucky number’ else print ‘Not a lucky number’.

                      <!DOCTYPE HTML>
                      <HTML>
                      <HEAD>

                          <TITLE> Nested if Statement </TITLE>
                      </HEAD>
                      <BODY>
                      <SCRIPT>

                          var number = parseInt(prompt("Enter a number: "));
                          if(number > 0)
                          {

                      88    Premium Edition-VIII

| 85 86 87 88 89 90 91 92 93 94 95 |