369 TESLAKALVIYOGI
Page 20 of 30

Logical Operators

AND, OR, NOT in 4 languages

</> logic
1

Concept Meaning

Logical operators combine or change conditions and return true or false.

2

Real-Life Analogy

For a student to pass with eligibility, mark must be enough and attendance must be enough.

3

Expected Output

true / false decision result
4

Common Mistake

Do not confuse AND with OR. AND needs both true; OR needs at least one true.

Same Logic • Different Syntax

Code in 4 Languages

JavaScript
let mark=80,att=90;
console.log(mark>=35 && att>=75);
console.log(mark>=90 || att>=90);
console.log(!(mark<35));
C++
int mark=80,att=90;
cout<<(mark>=35 && att>=75);
cout<<(mark>=90 || att>=90);
cout<<!(mark<35);
Python
mark=80
att=90
print(mark>=35 and att>=75)
print(mark>=90 or att>=90)
print(not(mark<35))
PHP
<?php
$mark=80;$att=90;
echo $mark>=35 && $att>=75;
echo $mark>=90 || $att>=90;
echo !($mark<35);
?>

Memory Tip

AND = both true, OR = any one true, NOT = opposite.