Paste Search Dynamic
str
  1. using system;
  2. public class Exercise
  3. {
  4.         public static void Main()
  5.         {
  6.                 string str;
  7.  
  8.                 Console.Write("\n\nWhat is your name? \n");
  9.                 str= Console.ReadLine();
  10.                 Console.Write("Your name is  : {0} \n",str );
  11.  
  12.                 int year;
  13.                                 year = Convert.ToInt32(Console.ReadLine());
  14.                 if (year==2020)
  15.                 {
  16.                 Console.Write("What is the current year?");
  17.                 Console.Write(" The current year is {0}",year);
  18.  
  19.                 }else if(year>=2020)
  20.                 {
  21.                         Console.WriteLine("That is not the current year");
  22.                 }
  23.  
  24.  
  25.  
  26.                 int born;
  27.                 Console.Write("What year were you born?");
  28.                 born = Convert.ToInt32(Console.ReadLine());
  29.                 Console.Write("You were born in {0}",born);
  30.                 Console.Write("Your Current age is {0} - {1} = {2}\n", year, born, year-born);
  31.  
  32.         }
  33. }
Parsed in 0.007 seconds