CSharp - Write program to Check both user name and password

Requirements

You will write a program that checks whether the user entered the correct username and correct password.

The username is case-insensitive.

Hint

The condition used is a compound condition.

Its partial conditions are connected using the conditional AND operator, &&

Demo

using System;
class Program/*from w ww .j  a v a2 s .com*/
{
    static void Main(string[] args)
    {
        // Correct values 
        string correctUsername = "joe";
        string correctPassword = "password";
        // Inputs 
        Console.Write("User name: ");
        string enteredUserName = Console.ReadLine();

        Console.Write("Password: ");
        string enteredPassword = Console.ReadLine();

        // Evaluating 
        if (enteredUserName.ToLower() == correctUsername.ToLower() &&
            enteredPassword == correctPassword)
        {
            Console.WriteLine("Thanks for your books!");
        }
        else
        {
            Console.WriteLine("Could not log you in.");
        }
    }
}

Result