Logical Operators Practice
Here's a summary of the primary logical operators:
Symbol | Name | Usage Example | Description |
---|---|---|---|
&& | AND | a && b | a AND b |
|| | OR | a || b | a OR b |
! | NOT | !a | NOT a |
Opgave
Swipe to start coding
Choose the appropriate comparison operators to ensure the expression evaluates to true
(logical 1
).
Løsning
99
1
2
3
4
5
6
7
8
9
10
11
12
13
#include <stdio.h>
int main()
{
int x = -6;
bool point = (x > -32 && x < 0);
printf("Is the expression logically correct?\n");
printf("%d\n", point);
return 0;
}
Var alt klart?
Tak for dine kommentarer!
Sektion 3. Kapitel 7
99
1
2
3
4
5
6
7
8
9
10
11
12
13
#include <stdio.h>
int main()
{
int x = -6;
bool point = (x ___ -32 && x ___ 0);
printf("Is the expression logically correct?\n");
printf("%d\n", point);
return 0;
}
Spørg AI
Spørg om hvad som helst eller prøv et af de foreslåede spørgsmål for at starte vores chat