Password as string Learn programming C# Sharp

Lesson:

Basic Data Types


Exercise:

Password as string 55


Objetive:

Write a C# program to ask the user for his/her name and his/her password (both must be strings) and repeat it as many times as necessary, until the entered name is "user" and the password is "password".


Code:

using System;
public class exercise51
{
    public static void Main()
    {
        string user, password;

        do
        {
            Console.Write("Enter a user: ");
            user = Console.ReadLine();

            Console.Write("Enter a password: ");
            password = Console.ReadLine();
        }
        while (user != "user" && password != "password");
        Console.WriteLine("Bye!");
    }
}