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
Explain me plz
ReplyDeletefrom the right 4 characters are extracted....and stored in p after converting into value
Deletefrom the right 4 characters are extracted....and stored in q after converting into value
then subtract and store in r
why there is r-1
ReplyDeletei think -1 is not required...
Deletei have edited this
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.
DeleteCAN WE FIND HOW MANY TEARS , MONTHS AND DAYS TOO ?
ReplyDeleteYEARS*
DeleteHOW CAN WE FIND COMPLETE DATE OF BIRTH ?? PLEASE TELL ME.....
ReplyDeletei can`t understand
ReplyDelete