VelizarAvramov

05. Word in Plural

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