Advertisement
svephoto

Personal Titles [C#]

Dec 23rd, 2019
544
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.81 KB | None | 0 0
  1. using System;
  2.  
  3. namespace PersonalTitles
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             double age = double.Parse(Console.ReadLine());
  10.             string gender = Console.ReadLine();
  11.  
  12.             if (gender == "m")
  13.             {
  14.                 if (age >= 16)
  15.                 {
  16.                     Console.WriteLine("Mr.");
  17.                 }
  18.                 else
  19.                 {
  20.                     Console.WriteLine("Master");
  21.                 }
  22.             }
  23.  
  24.             if (gender == "f")
  25.             {
  26.                 if (age >= 16)
  27.                 {
  28.                     Console.WriteLine("Ms.");
  29.                 }
  30.                 else
  31.                 {
  32.                     Console.WriteLine("Miss");
  33.                 }
  34.             }
  35.         }
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement