DO-WHILE loop challenge

1 week ago 20
ARTICLE AD BOX

I am reading a book to learn C# and this is the problem statement.

As an optional challenge, add statements so that the user can only make three attempts before an error message is displayed.

I tried and even searched it but couldn't find a solution.

using static System.Console; string? actualPassword = "ludo5656"; string? password; int maxAttempts = 3; do { Write("Enter your password: "); password = ReadLine(); } while (password != actualPassword); WriteLine("Correct!");
Read Entire Article