Venciity

[Jumpstart C#] Console HMWRK - Older , younger

Jan 31st, 2014
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.21 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Older___younger_or_same_age
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             Console.Write("age of the first: ");
  14.             int FirstAge = Int32.Parse(Console.ReadLine());
  15.             Console.Write("name of the first: ");
  16.             string FirstName = Console.ReadLine();
  17.             Console.Write("age of the second: ");
  18.             int SecondAge = Int32.Parse(Console.ReadLine());
  19.             Console.Write("name of the second: ");
  20.             string SecondName = Console.ReadLine();
  21.  
  22.  
  23.             if (FirstAge == SecondAge)
  24.             {
  25.                 Console.WriteLine("{0} is the same age as {1}", FirstName, SecondName);
  26.             }
  27.             else
  28.             {
  29.                 if (FirstAge > SecondAge)
  30.                 {
  31.                     Console.WriteLine("{0} is older than {1}", FirstName, SecondName);
  32.                 }
  33.                 else
  34.                 {
  35.                     Console.WriteLine("{0} is younger than {1}", FirstName, SecondName);
  36.                 }
  37.             }
  38.            
  39.         }
  40.     }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment