lmarkov

How Old You Will Be After 10 Years v2

Nov 19th, 2012
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.71 KB | None | 0 0
  1. using System;
  2.  
  3. class HowOldYouWillBeAfter10Years
  4. {
  5.     static void Main()
  6.     {
  7.         Console.WriteLine("How old are you?");
  8.        
  9.         int currentAge ;
  10.         int.TryParse(Console.ReadLine(), out currentAge);
  11.  
  12.         if (currentAge > 0 && currentAge <120)
  13.         {            
  14.             Console.WriteLine("Your age now is " + currentAge + " years old but after 10 years you will be " + (currentAge + 10));
  15.             if (currentAge + 10 > 120)
  16.             {
  17.                 Console.WriteLine("Greetings! You are a Highlander!");
  18.             }
  19.         }
  20.         else
  21.         {
  22.             Console.WriteLine("Please enter your age correctly!");
  23.             Main();
  24.         }
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment