**Operators**

Operators are symbols that indicate the type of operation.

– There are four types of operators in QBASIC.

1. Arithmetic Operators,

2. Relational Operators,

3. Logical Operators

4. String Operator.

**1)**** Arithmetic Operators**

- Arithmetic Operators are used to perform mathematical calculations
- like addition, subtraction, division, multiplication and exponential.
- The following table shows arithmetic operators used in QBASIC.

Operator |
Example |
output |
Operation |

+ | 2+2 | 4 | addition |

– | 4-3 | 1 | subtraction |

* | 2*2 | 4 | multiplication |

/ | 10/2 | 5 | division |

^ | 2^3 | 8 | Exponential |

Mod | 11mod5 | 1 | modular |

** **

**2)**** Relational Operators**

- Relational Operators are use to perform comparisons on two values of same type.
- A comparison of sting data with numeric data cannot be done.

Operator |
Example |
Operation |

= | A= B | Equal to |

> | A > B | Greater Than |

< | A < B | Less Than |

>= | A >= B | Greater than or equal to |

<= | A <= B | Less than or equal to |

< > | A < > B | Not equal to |

** **

**3)**** Logical Operators**

- QBASIC supports logical operators to perform logical operations on numeric values.
- Logical operators are used to connect two or more relations and return a TRUE or FALSE value to be used in a decision.
- The commonly used logical operators in QBASIC are AND, OR and NOT.

**AND Operator**

AND operator returns ‘True’ when all the results returned from individual relational expressions are ‘True’ otherwise it returns ‘False’

Condition-1 |
Condition-1 |
Output |

F |
T |
F |

T |
F |
F |

F |
F |
F |

T |
T |
T |

** **

**OR Operator**

OR Operator return ‘True’ if any one or both of the relational expressions returns ‘True’.

Condition-1 |
Condition-1 |
Output |

F |
T |
T |

T |
F |
T |

F |
F |
F |

T |
T |
T |

** **

**NOT Operator**

NOT Operator operates on one operand and returns ‘True’ if the logical operation returns ‘False’.

Operand |
Result |

T |
F |

F |
T |

** **

**4)**** String Operator**

- String Operator joins two or more than two sting.
- The plus sign (+) is used join two string.
- The result of combining two stings is called concatenation.

Operation |
Result |

“Hello ” + “World” |
Hello World |

“12”+”3” |
123 |