Q:

Write a C# Sharp program to check if a given string ends with "on"

0

Write a C# Sharp program to check if a given string ends with "on"

Sample Output:

False
True
True
False

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

using System;
namespace exercises
{
   class Program
    {       
        static void Main(string[] args)
        {
            Console.WriteLine(test("Hello"));
            Console.WriteLine(test("Python"));
            Console.WriteLine(test("on"));
            Console.WriteLine(test("o"));
            Console.ReadLine();
        }
        public static bool test(string s1)
         {
              return s1.EndsWith("on");
         }
  }
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now