I wrote this and it is not working, any ideas where I have gone wrong? And yes I am new to programming. Thanks in advance for any suggestions.
if ((int.Parse(Console.ReadLine()) < 10) && (int.Parse(Console.ReadLine()) > 0))
Console.WriteLine("The right number!!");
else
Console.WriteLine("The wrong number!!");
Console.ReadLine();
It isn’t working as you would expect because the way the if statement is written is expecting 2 lines of text to be read in from the console (as you’ve used Console.ReadLine()) twice.
You should be first assigning the input value to a variable
Which can then be used twice in the if statement as below: