DEV Community

bhuvaneswari nandhagopal
bhuvaneswari nandhagopal

Posted on

ARITHMETIC & LOGICAL OPERATORS:

What is arithmetic operators?
arithmetic operators are symbols used to perform mathematical calculation is programing.

operators Name

  • Addition
  • Subtraction
  • Multiplication / Division // Floor Division % Modulus ** Exponent

Addition:

a=10
b=3
print(a+b)
Enter fullscreen mode Exit fullscreen mode

output
13

Subtraction:

a=10
b=3
print(a-b)
Enter fullscreen mode Exit fullscreen mode

output
7

Multiplication:

a=10
b=3
print(a*b)
Enter fullscreen mode Exit fullscreen mode

output
30

Division:

a=10
b=3
print(a/b)
Enter fullscreen mode Exit fullscreen mode

output
3.333...

Modulus(remainder):

a=10
b=3
print(a%b)
Enter fullscreen mode Exit fullscreen mode

output
1

Floor Division:

a=10
b=3
print(a//b)
Enter fullscreen mode Exit fullscreen mode

output
3

Exponent(power)

a=10
b=3
print(a**b)
Enter fullscreen mode Exit fullscreen mode


`
output
1000

What is logical operators?
Logical operators are use combine condition and true of false.
Logical operators are symbols or keywords used to evaluate and combine boolean expressions, producing a result of either True or False. They are fundamental in decision-making, flow control, and conditional statements in programming, and also form the basis of Boolean logic used in computer circuits.

Common logical operators include:

1.AND (and / &&) – Returns True only if both conditions are true.

2.OR (or / ||) – Returns True if at least one condition is true.

3.NOT (not / !) – Negates the boolean value of an expression.

4.XOR (^) – Returns True if exactly one condition is true.
[TBD]

[TBD]

R E F E R E N C E:

https://www.bing.com/images/search?view=detailV2&ccid=iSHePVXy&id=8D26AF1F2F043CFA01108A954182F2A89DD8F9EE&thid=OIP.iSHePVXysvifAVpWYgvwaAHaFI&mediaurl=https%3a%2f%2fwww.startertutorials.com%2fcorejava%2fwp-content%2fuploads%2f2014%2f10%2fLogical-operators.jpg&exph=450&expw=650&q=logical+operators+images&FORM=IRPRST&ck=DC3FC4E795C4B82C9C8E770D38608CB2&selectedIndex=0&itb=0&idpp=overlayview&ajaxhist=0&ajaxserp=0

https://www.bing.com/search?qs=HS&pq=what+is+lo&sk=CSYN1&sc=16-10&pglt=299&q=what+is+logical+operator&cvid=04e0b6e203d84c4099e8ebf5ce8a7b4d&gs_lcrp=EgRlZGdlKgcIABAAGPkHMgcIABAAGPkHMgYIARBFGDkyBggCEEUYOzIGCAMQABhAMgYIBBAAGEAyBggFEAAYQDIGCAYQABhAMgYIBxBFGD0yBwgIEOsHGEDSAQg5OTA3ajBqN6gCCLACAQ&FORM=ANNTA1&PC=U531&source=chrome.ob

Top comments (0)