Advertisement
skipter

C# Fundamentals - Words in Plural / remove and add char

Jun 2nd, 2017
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.76 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. namespace ConsoleApp9
  7. {
  8.     class Program
  9.     {
  10.         static void Main(string[] args)
  11.         {
  12.             string noun = Console.ReadLine();
  13.  
  14.             if (noun.EndsWith("y"))
  15.             {
  16.                 noun = noun.Remove(noun.Length - 1);
  17.                 Console.WriteLine(noun + "ies");
  18.  
  19.             } else if (noun.EndsWith("o") || noun.EndsWith("s") || noun.EndsWith("x") || noun.EndsWith("z") || noun.EndsWith("ch") || noun.EndsWith("sh"))
  20.             {
  21.                 Console.WriteLine(noun + "es");
  22.             } else
  23.             {
  24.                 Console.WriteLine(noun + "s");
  25.             }    
  26.         }
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement