You are on page 1of 3

Practice Problem-1

Computer Science-2210
Topic: Section

 Selection:
Selection statements (sometimes called conditional statements) can be
defined as code (statements) that checks conditions and determines which
code to run.
There are two forms of selection: 1. IF statement, 2. CASE statement.
 If statement has three types of condition statement:
1. IF statement:
Structure of IF statement:
IF comparison THEN
Statements that run if the condition is true
ENDIF
2. ELSE:
Structure of IF statement:
IF comparison THEN
Statements that run if the condition is true
ELSE
Statements that run if the condition is false
ENDIF
3. ELSEIF:
Structure of IF statement:
IFcomparison1 THEN
Statements that run if the condition is true
ELSEIF comparison2 THEN
Statements that run if the condition1 is false, and comparison2 is true
ENDIF
 CASE Statement:
CASE follows the structure:
CASE OF variable
Value1:
Statement that run if CASE value1 is true
Value2:
Statement that run if CASE value1 is false, and value2 is true
Value1:
Statement that run ifnone of the comparisons are true

Write pseudocodes for the problems mentioned below:


1. A system outputs the smallest number between two numbers.
2. A system outputs the largest number between three numbers.
3. A voting system checks the age of the voter and allows him/her to vote if his age is
more than 16 and has to be Citizen of Bangladesh. Output appropriate message
according to the age.
4. Using a SELECT-CASE a system outputs the grade for in-lesson test where grade A is
>=80, grade B is >=70, grade C is >=60, grade D is >=50

You might also like