[Solved] Cannot print else statement in solution [closed]


Well it’s normal that in doesn’t enter the else statement. You’re doing if (num > 10) and num is the value entered by the user which never changes during the process. So if num = 15 you’re always doing is 15 > 10.

Then only moment the else statement is gonna print is if the number entered is 10.

And the moment num is smaller than 10, you’ll never get in the for loop so the number will never be smaller than 0 inside the loop so that line won’t make sense even if it’s played

Console.WriteLine("The integer entered is less than zero and cannot be used in code ");

Cause like i said if this line is printed that means the value in num was 10 which is not less than zero.

You could change it for something like this

if(num < 10)
{
    Console.WriteLine("It's smaller than 10");
}

for(int num3 = num; 10 <= num3; num3--)
{
    Console.WriteLine(num3);
}

8

solved Cannot print else statement in solution [closed]