C# Console
Age Calculator
“Type your birthday. Get back something surprisingly satisfying.”
What you will have
A C# program that takes your date of birth and calculates your exact age in years, months and days — plus a countdown to your next birthday.
It handles dates, does real maths, and gives you information you didn’t already know. That’s what useful software does.
Video Walkthrough
Watch the full lesson.
Your prompt
Copy this. Paste it into your AI. Hit Enter.
📋 Your Prompt — Copy Everything Below
Write a C# console application that asks the user to enter their date of birth in DD/MM/YYYY format. Calculate and display their exact age in years, months, and days. Also calculate how many days until their next birthday and display that too. Handle invalid date input gracefully with a friendly error message.
✅ Copied! Now paste it into your AI.
What to do after
Follow these steps exactly.
1
Create a new Console App project
Visual Studio → Create a new project → Console App (C#) → name it AgeCalculator → Create.
2
Delete starter code and paste yours in
Ctrl+A → Delete → Ctrl+V.
3
Press F5 to run
Type your date of birth in DD/MM/YYYY format — for example 15/06/1990.
4
Try a wrong date on purpose
Type 99/99/9999 and see what happens. Good programs handle mistakes gracefully.
🛠️ Didn’t work?
Don’t panic. Here’s exactly what to do:
1 Look at the error list at the bottom of Visual Studio
2 Copy the error message
3 Say: “This didn’t work. Here’s the error: [paste it]. Please fix it.”
Vibe Tweak
Add a fun fact.
Find the section that prints the results. Add one more line that prints how many hours old the user is. Multiply their age in days by 24.
The formula
days * 24
→
Print something like
“You are X hours old!”
Extra Credit
Want to go further?
📋 Extra Credit Prompt
Update the age calculator to also tell the user what day of the week they were born on, what the most popular song was in the year they were born (hardcode a list of years from 1950 to 2010), and how old they will be in the year 2050.
✅ Copied!
Reflection
Before you move on — think about this.
“This program did real date maths that would have taken hours to figure out from scratch. Can you find the line that gets today’s date? What does DateTime.Now tell you about how C# thinks about time?”