Advertisement
Guest User

05 Word in Plural

a guest
May 25th, 2017
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.00 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 _05_Word_in_Plural
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             string word = Console.ReadLine();
  14.  
  15.             char[] plural = word.ToCharArray();
  16.  
  17.             if (plural[plural.Length - 1] == 'y')
  18.             {
  19.                 plural[plural.Length - 1] = 'i';
  20.                 Console.Write(string.Join("", plural));
  21.                 Console.WriteLine("es");
  22.             }
  23.             else if (plural[plural.Length - 1] == 'o' ||
  24.                 plural[plural.Length - 1] == 'h' ||
  25.                 plural[plural.Length - 1] == 's' ||
  26.                 plural[plural.Length - 1] == 'x' ||
  27.                 plural[plural.Length - 1] == 'z')
  28.             {
  29.                 Console.WriteLine(word + "es");
  30.             }
  31.             else
  32.             {
  33.                 Console.WriteLine(word + "s");
  34.             }
  35.         }
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement