CSharp - Write program to combine several AND and OR operators

Requirements

You will check the user name and password combination for two users.

Both will have their own passwords.

Hint

You can combine both conditional operators: AND with OR.

Demo

using System;


class Program//from  ww w  . jav a  2 s  .c  o  m
{
    static void Main(string[] args)
    {
        // Correct values 
        string correctUsername1 = "a";
        string correctPassword1 = "pass1";

        string correctUsername2 = "b";
        string correctPassword2 = "pass2";

        // Inputs 
        Console.Write("User name: ");
        string enteredUsername = Console.ReadLine();

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

        // Evalulating 
        if (enteredUsername.ToLower() == correctUsername1.ToLower() &&
            enteredPassword == correctPassword1 ||
            enteredUsername.ToLower() == correctUsername2.ToLower() &&
            enteredPassword == correctPassword2)
        {
            Console.WriteLine("Thanks for your books!");
        }
        else
        {
            Console.WriteLine("Could not log you in.");
        }

    }
}

Result