Class 9 Computer Notes
Selection Statements
General Definition: Statements that can be used to apply conditions in a
program during its execution are called Selection Statements.
Types-
If statement
If-else statement
If-else-if ladder
Switch statement
Ternary Operator
If Statement: Holds one condition on which it will provide an output if
condition becomes true.
If-else Statement: Also holds one output but if the result is false it will perform
task written in the else statement.
If-else-if Ladder: It is used to apply more than one condition in an program.
Switch Case Statements: Can be used choose between multiple option given
by the computer.
Ternary Operator: Can be classified as short version of if statement which can
be written in only one line.
Examples:
If Statement
WAP to print “OK” if the user is above the age of 18.
If-else Statement
WAP to print the eligibility of user to vote(i.e. to print yes/no after checking
user’s age.)
If-else-if Ladder
WAP to print the largest of three numbers.
Switch Case Statement
Write a menu driven program for performing addition on 1, subtraction on 2,
Multiplication on 3 and Division on 4
Ternary Operator
Without using if-else WAP to check whether the user is eligible to vote or not.
IN THIS WE PROVIDE NOTES FOR CLASS 9 ON COMPUTER
More Notes will be provided
Soon…….
Thank You