x

Choose Country Code

x

Direction

x

Ask a Question

  • Ask a Question
  • Scan a Question
  • Post MCQ
  • Note: File extension must be of jpg, jpeg, png, bmp format and file size must not exceed 5 MB
x

Ask a Question

x

x
x
x
Hire a Tutor

Answers and Solutions

What's Your Question?
Answer

Arithmetic Operators -- Used to perform all types of mathematical operations in the program/s if required.

Logical Operators --  Some conditions which require single value operations or two or more validations such as (age > 21) for voting , etc.

Answer

Arithmetic Operators

 

Performing operations on the operands(i.e a and b)

Here all operations can work on integers and decimal numbers

Ex : a=3, b=2

1.Addition(+)   - Adding the operands 

a+b = 3+2 = 5

2.Subtraction(-)  - Subtracting the operands

a-b = 3-2 = 1

3.Multiplication(*)  - Multiply the operands

a*b = 3*2 = 6

4.Division(/)  - Divide operand1 by operand2 then gives result of quotient

a/b = 3/2 = 1.5

5.Modolous(%) - Divide operand1 by operand2 then gives result of remainder

a%b = 3%2 = 1

6.Exponential(**) - Gives the result of operand1 power operand2( op1^op2)

a**b = 3**2 = 9

7.Floor Division(//) - Divide operand1 by operand2 the gives result of quotient without decimal points

a//b = 3//2 = 1

Here 3/2 = 1.5 In floor division it removes floating point values so 3//2 = 1

 

Logical Operators

 

Logical operators are used to combine conditional statements.

a=3, b=2

1.and - If both conditions are true then result is True

           a               b               a and b

  • True          True            True
  • True          False          False
  • False         True           False
  • False         False         False

 EX  :  a>1 and b>1  => True

2. or - If one of the condition is true then the result is True

          a                 b              a  or b

  • True          True            True
  • True          False          True
  • False         True           True
  • False         False         False

EX :    a>1 or b==1   => True

3. not - If condition is true then the result is False (Viceversa)

             a             not(a)

  • True            False
  • False           True

EX :   not(a==3)  => False

Post Answer and Earn Credit Points

Get 5 credit points for each correct answer. The best one gets 25 in all.

Post Answer