Relational Operators Org
Relational Operators Org
Operators
Programming
Fundamentals
Hamza
Sani
Presentation
Includes
Introduction
Example
Syntax
Flow Chart
Program
3
Types
of Relational
Operators
and their functions
Operator Symbol Description Example Returns
true if a is equal to b,
Equal to == Checks if two operands are equal a == b
else false
Loops: To control how long loops run (e.g., run while a condition is
true).
Example
int a = 9, b = 10 ;
7
Using in Code
Expected
Output
In this output:
1 means the condition is true
0 means the condition is false
Program Example
10
Output
First possible
output
Second possible
output
Third possible
output
Flow
Chart
Of above program
Another
Example
What the above program do?
Takes Input: It asks the user to enter a percentage score (for example, 85). This score
is stored in a variable named numbers
Checks the Score Range: The program then compares the Displays the Grade: Based on the score,
input score against different ranges to determine the the program prints out the grade (A, B,
grade: C, D, E, or F) to the screen.
• If the score is 90 or above, it assigns an A grade.
• If the score is between 80 and 89, it assigns a B grade.
• If the score is between 70 and 79, it assigns a C grade.
• If the score is between 60 and 69, it assigns a D grade.
• If the score is between 50 and 59, it assigns an E grade.
• If the score is below 50, it assigns an F grade and also
displays "Fail."
THANK
YOU
Hamza Sani