Write a C# Sharp program to check whether a given word is plural or not

  • برمجة سي شارب
  • برمجة

Write a C# Sharp program to check whether a given word is plural or not

Singular means only one and plural means more than one. In order to make a noun plural, it is usually only necessary to add s.

Sample Output:

Is 'Exercise' is plural? False
Is 'Exercises' is plural? True
Is 'Books' is plural? True
Is 'Book' is plural? False

الأجوبة

using System;
namespace exercises
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Is 'Exercise' is plural? " + test("Exercise"));
            Console.WriteLine("Is 'Exercises' is plural? " + test("Exercises"));
            Console.WriteLine("Is 'Books' is plural? " + test("Books"));
            Console.WriteLine("Is 'Book' is plural? " + test("Book"));
        }
        public static bool test(string word)
        {
            return word.EndsWith("s");
        }
    }
}
هل كان المحتوى مفيد؟

تبحث عن مدرس اونلاين؟

محتاج مساعدة باختيار المدرس الافضل؟ تواصل مع فريقنا الان لمساعدتك بتأمين افضل مدرس
ماهو التخصص الذي تبحث عنه؟
اكتب هنا...