diff --git a/2-variables/10-YearOfTheX.cs b/2-variables/10-YearOfTheX.cs index 1c5c4f1..69af00f 100644 --- a/2-variables/10-YearOfTheX.cs +++ b/2-variables/10-YearOfTheX.cs @@ -1,21 +1,14 @@ -// Year of the X 📆 -// Codédex - using System; -class YearOfTheX +class Program { - static void Main() - { - Console.WriteLine("What year were you born?"); - - string input = Console.ReadLine(); - int birthYear = int.Parse(input); - - int cycle = 12; - - int yearsUntilZodiac = (cycle - ((currentYear - birthYear) % cycle)) % cycle; - - Console.WriteLine("Your zodiac year comes again in " + yearsUntilZodiac + " year(s)!"); - } -} \ No newline at end of file + static void Main() + { + Console.Write("Enter your birth year: "); + int birthYear = int.Parse(Console.ReadLine()); + + int yearsPassed = DateTime.Now.Year - birthYear; + int yearsUntilNextZodiac = (12 - yearsPassed % 12) % 12; + Console.WriteLine(yearsUntilNextZodiac); + } +}