using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
public class Person
{
DateTime dob;
public DateTime Dob
{
get{return dob;}
set{dob=value;}
}
public void DisplayDetails()
{
Console.WriteLine(calculateAge(dob));
}
public static int calculateAge(DateTime dob){
int age=0;
age=DateTime.Now.Year-dob.Year;
return age;
}
}
namespace DateEx1 //DO NOT CHANGE the namespace name
{
public class Program //DO NOT CHANGE the class name
{
public static void Main(string[] args) //DO NOT CHANGE the 'Main' method signature
{
Person person=new Person();
Console.WriteLine("Enter the date of birth (dd-mm-yyyy): ");
person.Dob=Convert.ToDateTime(Console.ReadLine());
person.DisplayDetails();
}
}
}