+ 2
In C language: Is it like this?~ If (!(x>2 || x<0) - Given, If (!(x>2)) - I thought so... Plz reply
I just started learning programming so help me Seniors😊
6 Respuestas
+ 7
Manthan Gohel
x is bigger than 2 so
x>2 returns 1
1||anything return 1 and it will not check if y is smaller than 0 or not because it got an absolute answer
!1 is 0
0 is false that means else statements will be executed
+ 5
in my understanding
consider the following example
int a=1;//true;
int b=0//false;
if(a||b&&a&&b&&++a||++b);
printf("%d%d",a,b);
output: 10
true or any case returns true so it will not check the rest of condition when we use ||
false and any case returns false
so it will not check the rest of cases when the there is false &&(...)
I think that is what you want
+ 3
In the first statement, it is true when X is not between 0 and 2.
In the second it is true when x is smaller than two(don't forget that there are negative numbers)
+ 2
! is used for negation, as the NOT operator if that's what you mean.
+ 1
Ace, It's like this~
x = 3;
y = 8;
If (!(x>2 || y<0))
printf("True");
else
printf("False");
And the ANSWER is FALSE.
So I am guessing that~
If (!(x>2 || y<0)) Is given,
First,
If (!(x>2))
Then,
! Comes in, make x>2 FALSE
Am I right or not please tell me