On the planet Mongo, each year has 15 months and each month has 26 days.
Write a function compute_mongo_age(birthYear, birthMonth, birthDay, currentYear, currentMonth, currentDay)
that residents of Mongo can use to compute their age. It should take 6 positive integers as input: the person's birthdate (year, month from 1 to 15, and day from 1 to 26) and the current date (year, month from 1 to 15, and day from 1 to 26), and return a float of the age of the person in years.

For example, print(compute_mongo_age(2879,8,11,2892,2,21)) should print 12.6256410256, the age (in Mongo years) of a person, who was born on the 11th day of the 8th month of the year 2879, is on the 21st day of the 2nd month of the year 2892.

Respuesta :

Answer:

DateTime now = DateTime.Today;

int age = now.Year - bday.Year;

if (now < bday.AddYears(age))

age--;

So your helper method would look like:

public static string Age(this HtmlHelper helper, DateTime birthday)

{

DateTime now = DateTime.Today;

int age = now.Year - birthday.Year;

if (now < birthday.AddYears(age))

age--;