0
What is wrong with folowing if statement in C (at least 3)
if numNeighbors>=3 || numNeighbors=4 ++numNeighbors; printf("You are dead!\n"); else --numNeighbors;
3 Réponses
+ 3
() in if condition
; in printf statement
and most important
{ } inside if block.
if (numNeighbors>=3 || numNeighbors==4)
{
++numNeighbors;
printf("You are dead!\n");
}
else
--numNeighbors;
0
in printf statement thr is a semicolon know?
- 1
Assuming C#:
1) Should be numNeighbors == 4 not =
2) Need {} around two lines after first conditional
3) Need semicolon at end of printf line