CSharp - Write program to Change text case

Requirements

The user will enter two names.

You will evaluate whether they are the same or different, disregarding the difference between lowercase and uppercase.

Hint

You need to convert both pieces of text to lowercase prior to doing the comparison.

You can use the ToLower method call for that purpose.

Demo

using System;
class Program//from  w ww  . j  a va2s  . c o  m
{
    static void Main(string[] args)
    {
        // Inputs 
        Console.Write("Enter a name: ");
        string name1 = Console.ReadLine();

        Console.Write("Enter another name: ");
        string name2 = Console.ReadLine();

        // Converting to small letters 
        string name1inSmall = name1.ToLower();
        string name2inSmall = name2.ToLower();

        // Evaluating 
        if (name1inSmall == name2inSmall)
        {
            Console.WriteLine("You have entered the same names");
        }
        else
        {
            Console.WriteLine("You have entered different names");
        }
    }
}

Result