lmarkov

How Old You Will Be After 10 Years

Nov 19th, 2012
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.67 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.         int currentAge = int.Parse(Console.ReadLine());
  9.         if (currentAge > 0 && currentAge <120)
  10.         {            
  11.             Console.WriteLine("Your age now is " + currentAge + " years old but after 10 years you will be " + (currentAge + 10));
  12.             if (currentAge + 10 > 120)
  13.             {
  14.                 Console.WriteLine("Greetings! You are a Highlander!");
  15.             }
  16.         }
  17.         else
  18.         {
  19.             Console.WriteLine("Please enter your age correctly!");
  20.             Main();
  21.         }
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment