Advertisement
Dianov

Conditional Statements Advanced - Lab (04. Personal Titles)

Nov 1st, 2020
87
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. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace PersonalTitles
  8. {
  9.     class Program
  10.     {
  11.         public static void Main()
  12.         {
  13.             double age = double.Parse(Console.ReadLine());
  14.             string sex = Console.ReadLine();
  15.             if (age >= 16 && sex == "m")
  16.             {
  17.                 Console.WriteLine("Mr.");
  18.             }
  19.             else if (age < 16 && sex == "m")
  20.             {
  21.                 Console.WriteLine("Master");
  22.             }
  23.             else if (age >= 16 && sex == "f")
  24.             {
  25.                 Console.WriteLine("Ms.");
  26.             }
  27.             else if (age < 16 && sex == "f")
  28.             {
  29.                 Console.WriteLine("Miss");
  30.             }
  31.         }
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement