Saturday, March 10, 2018

Qbasic Program that accepts date of birth of a person in the MM-DD-YYYY FORMAT AND DISPLAYS THE AGES OF A PERSON.

Qbasic Program that accepts date of birth of a person in the MM-DD-YYYY FORMAT AND DISPLAYS THE AGES OF A PERSON.

CLS
INPUT "enter your date of birth"; d$
p = VAL(RIGHT$(d$, 4))
q = VAL(RIGHT$(DATE$, 4))
r = q - p
PRINT "your age is"; r

END


9 comments:

  1. Replies
    1. from the right 4 characters are extracted....and stored in p after converting into value
      from the right 4 characters are extracted....and stored in q after converting into value
      then subtract and store in r


      Delete
  2. Replies
    1. i think -1 is not required...
      i have edited this

      Delete
    2. d$ is your birth Date and DATE$ is the current date given by your operating system. The Answer returnes is simply a deduction of gregorian year values (Months and dates are not counted.This can be accomplished by simple subtraction of Gregorian years; no need for computer program.

      Delete
  3. CAN WE FIND HOW MANY TEARS , MONTHS AND DAYS TOO ?

    ReplyDelete
  4. HOW CAN WE FIND COMPLETE DATE OF BIRTH ?? PLEASE TELL ME.....

    ReplyDelete