+ 1
Multiple conditions in a 'do while' loop
I have been trying to use the logical operator "&&" but I am not sure how to use it in my code(this is in C) do { // do something } while((8<height)&&(1>height)); height is an int which is an input
2 Respostas
+ 4
If both are true block will execute.
its possible you have them the wrong way round as height is the changing variable
while(height > 1 && height < 8){doSomthing};
if height equals a number between 2 and 7 this will execute.
+ 3
Logical AND operator. If both the operands are non-zero, then the condition becomes true.
https://www.programiz.com/c-programming/c-operators