Computer Science, asked by moumitasurai, 3 months ago

in qbasic how to print the time left for my birthday and my present age .. take the birth date as input..​

Answers

Answered by ayesha7734
2

Answer:

I now did it in all 3 possible ways...

- Using a loop: will return the correct results, except from leaplings

- Using average calculation: will mostly return correct results and sometimes return ages that are +1 or -1

- Using conditional checks: will probably (only tested 80000 times yet) return correct results, including leaplings

Explanation:

Private Function getPersonAge (Year As Integer, Month As Integer, Day As Integer, _

NowYear As Integer, NowMonth As Integer, NowDay As Integer) As Integer

If (NowMonth > Month) Or (NowMonth = Month And NowDay >= Day) Then getPersonAge = NowYear - Year Else getPersonAge = NowYear - Year - 1

Similar questions