Page 88 - PortGPT_V2.1_C8_Flipbook
P. 88

False
                                                Test Expression 1          Statement 3


                                                        True


                                                                 False
                                                Test Expression 2          Statement 2


                                                        True


                                                  Statement 1






                   Program  5: To  find out  if  the  student  is selected  for  the  college  or  not  based  on  the  given
                   conditions –
                   1.  Selected if age > 18 and marks > 65.
                   2.   Not selected if age > 18 and marks < 65.
                   3.   Not selected if age < 18.



                  <!DOCTYPE HTML>
                  <HTML>

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

                  <BODY>
                  <SCRIPT>
                      var name = prompt("Enter the name of the student: ");
                      var age = parseInt(prompt("Enter the age of the student: "));

                      var marks = parseInt(prompt("Enter the marks of the student: "));
                      if(age > 18)
                      {
                        if(marks > 65)

                        {
                                document.write(name, " is selected for college");
                        }
                        else

                        {




                  86    Premium Edition-VIII
   83   84   85   86   87   88   89   90   91   92   93