veronikaaa86

05. Word in Plural

Jan 31st, 2018
360
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.69 KB | None | 0 0
  1. namespace Ex5_WorldInPlural
  2. {
  3.     using System;
  4.     public class Program
  5.     {
  6.         public static void Main(string[] args)
  7.         {
  8.             var noun = Console.ReadLine();
  9.  
  10.             if (noun.EndsWith("y"))
  11.             {
  12.                 noun = noun.Remove(noun.Length - 1);
  13.                 Console.WriteLine(noun + "ies");
  14.             }
  15.             else if (noun.EndsWith("o") || noun.EndsWith("ch") || noun.EndsWith("s") || noun.EndsWith("sh") || noun.EndsWith("x") || noun.EndsWith("z"))
  16.             {
  17.                 Console.WriteLine(noun + "es");
  18.             }
  19.             else
  20.             {
  21.                 Console.WriteLine(noun + "s");
  22.             }
  23.         }
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment