Advertisement
bacco

Обръщение според възраст и пол

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