Write a program that takes nouns and forms their plurals on the basis of these rules:a.If a noun ends in “y”, remove the”y” and add “ies”
b. If a noun ends in “s”, “ch” or “sh”, add “es” c. In all other cases, just add “s”
using System;
namespace Test
{
class NounTest
{
static void Main()
{
Console.Write("Enter some noun: ");
string noun = Console.ReadLine();
Console.Write("The plural is '");
if(noun.EndsWith("y"))
{
Console.WriteLine(noun.Remove(noun.Length - 1) + "ies'");
}
else
if(noun.EndsWith("s") || noun.EndsWith("sh") || noun.EndsWith("ch"))
{
Console.WriteLine(noun + "es'");
}
else
{
Console.WriteLine(noun + "s'");
}
}
}
}
Comments
Leave a comment