Wednesday, October 16, 2019

52. Qbasic program to find out whether the person can cast vote or not


52.      Input the age of a person and find out whether the person can cast vote or not using sub procedure. [age >=18]

DECLARE FUNCTION CHECK$ (A)
CLS
INPUT “ENTER YOUR AGE”; A
PRINT “YOU ARE “; CHECK$(A)
END
FUNCTION CHECK$ (A)
IF A >= 18 THEN
CHECK$ = “ELIGIBLE TO VOTE”
ELSE
CHECK$ = “ NOT ELIGIBLE TO VOTE”
END IF
END FUNCTION

4 comments:

  1. i wanted to clear my doubt that while using the IF..ELSE statement not the IF..THEN...ELSE statement while we are ending the writing of the program we need to directly write END statement or we need to write
    END IF
    END please make me clear about that!!

    END please make me clear about that !!

    ReplyDelete
    Replies
    1. IT DEPENDS
      HOW THE QN IS

      FOR EX: IF QN ASK U
      WAP TO PRINT WHETHER GIVEN NUUMBER IS EVEN OR ODD

      THEN
      REMEMBER IF WHETHER IS ADDED IN THE QN THEN DEFINETLY THERE U WILL USE IF
      AND FOR ENDING

      U HAVE TO USE ENDIF
      END

      OTHERWISE IT WON'T WORK

      U MAY CHECK

      GRADE:8

      Delete
  2. There is a choice like if you use "IF" then you need to write "End IF". But if you are not writing "IF" then you need not write to "End If".(Note:You need to care through which procedure you are writing program then you will be clear from doubt)

    ReplyDelete
  3. Thank u I really need help for my exam

    ReplyDelete