0
trying to code a "and" statement in c# (answered)
https://code.sololearn.com/cYjrRmhVW2PZ i keep getting errors (i am still learning c#)
4 Answers
+ 2
* don't out semicolon after if statement and the total compound statement condition should enclose in brace
* in c#, and operator is &&
* in Writeline, readline, the letter l must be capital. L
Like :
if( (numbera == 1) && (numberb == 1) )
Console.WriteLine("1");
* typo of using = , instead of == in last if.
Do changes in all instances.. hope it helps you..
+ 2
Just in case you need an example from Jayakrishna🇮🇳 perfect advice
if((numbera == 1) && (numberb == 1))
{
Console.WriteLine("1");
}
else
if((numbera == 1) && (numberb == 0))
{
Console.WriteLine("0");
}
+ 1
use &&
0
it works now thanks