# Relational Operators – A practical Exercise

Pre-Requisite : Read (Campbell, Information Technology for CSEC – 3rd Edition, 2020, pp. 272-273)

Observe the attached flowgorithm file, or the pseudocode below:

```
```
```Start
// Here we set up 2 numbers to experiment with our relational operators....
FirstNum = 7
SecondNum = 5

// Comparison: First number is greater than second number
greaterThan = FirstNum > SecondNum
output "' " + FirstNum + " is greater than " + SecondNum + " ' evaluates to " + greaterThan

// Comparison: First number is greater or equal to second number
greaterThanOrEqualTo = FirstNum >= SecondNum
output "' " + FirstNum + " is greater than or equal to " + SecondNum + " ' evaluates to " + greaterThanOrEqualTo

// Comparison: First number is equal to second number
equalTo = FirstNum = SecondNum
output "' " + FirstNum + " is equal to " + SecondNum + " ' evaluates to " + equalTo

// Comparison: First number is not equal to second number
notEqualTo = FirstNum ≠ SecondNum
output "' " + FirstNum + " is not equal to " + SecondNum + " ' evaluates to " + notEqualTo

// Comparison: First number is less than second number
lessThan = FirstNum < SecondNum
output "' " + FirstNum + " is less than " + SecondNum + " ' evaluates to " + lessThan

// Comparison: First number is less than or equal to second number
lessThanOrEqualTo = FirstNum <= SecondNum
output "' " + FirstNum + " is less than or equal to " + SecondNum + " ' evaluates to " + lessThanOrEqualTo
Stop

```

The flowgorithm file or the pseudocode above should output:

‘ 7 is greater than 5 ‘ evaluates to true
‘ 7 is greater than or equal to 5 ‘ evaluates to true
‘ 7 is equal to 5 ‘ evaluates to false
‘ 7 is not equal to 5 ‘ evaluates to true
‘ 7 is less than 5 ‘ evaluates to false
‘ 7 is less than or equal to 5 ‘ evaluates to false