VelizarAvramov

05. Word in Plural

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