Page 115 - TechPluse_C7_Flipbook
P. 115

end if
                       7.   input "Enter a number: ", num

                            if num < 0 then
                                print num; " is a negative number."
                            end if
                       8.   input "Enter a number: ", num

                            if num mod 3 = 0 then
                                print num; " is a multiple of 3."

                            else
                                print num; " is not a multiple of 3."
                            end if
                       9.   input "Enter a number: ", num

                            if num > 10 then
                                print num; " is greater than 10."
                            else

                                print num; " is not greater than 10."
                            end if
                   Lab Session                                                                          Interdisciplinary



                   Write a program to:
                   1.  check whether a given number is positive or negative.
                   2.   input the year from the user and check whether the input year is a leap year or not.

                   3.  compare two numbers and print the result accordingly.
                   4.   find out whether the student is selected for the college or not, based on the given condition,
                       if age is greater than 18 and marks are greater than 65, then print ‘Student is eligible to
                       take admission in the college.’, else display ‘Student is not eligible to take admission in the
                       college.’, if age < 18, then print ‘‘Student is underage.’

                   5.  print the series 1, 4, 7, 10, ..., 40 using FOR…NEXT statement.
                   6.  input the number and print the reverse of the input number.
                   7.  print the table of the number input by the user, using FOR…NEXT statement.
                   8.   display all the odd numbers and even numbers from 1 to 30 using WHILE…END...WHILE
                       statement. Also, print the sum of all the odd and even numbers separately.
                   9.  create a FOR loop to print the Fibonacci series. For example 0, 1, 1, 2, 3, 5, 8, 13, 21, etc.



                 Teacher's Note

                   1.  Discuss about conditional statements of BASIC-256 with the students.
                   2.  Go through all the topics covered in this chapter.
                   3.  Explain the concept of looping statements to the students.



                                                             Conditional and Looping Statements in BASIC-256         113
   110   111   112   113   114   115   116   117   118   119   120