You will test for inequality instead of equality during the password verification.
The Not Equals Operator is !=
using System; class Program//from w ww. j a va 2s . c o m { static void Main(string[] args) { // Correct password string correctPassword = "friend"; // Input Console.Write("Enter password: "); string enteredPassword = Console.ReadLine(); // Password check if (enteredPassword != correctPassword) { Console.WriteLine("Incorrect password"); } else { Console.WriteLine("Password is OK, please enter"); } } }