0% found this document useful (0 votes)
48 views4 pages

Lab 2: Problem Solving Using Algorithm: Pseudocode

The document discusses algorithm design using pseudocode and flowcharts. It provides examples of pseudocode to calculate the area of a circle and a flowchart to do the same. It then lists 5 exercises for students to write pseudocode and design flowcharts for algorithms to: 1) add two numbers, 2) convert temperatures between Fahrenheit and Celsius, 3) find the greater of two numbers, 4) calculate and display the area of a rectangle, and 5) find the largest of three numbers.

Uploaded by

Ainur Nasuha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views4 pages

Lab 2: Problem Solving Using Algorithm: Pseudocode

The document discusses algorithm design using pseudocode and flowcharts. It provides examples of pseudocode to calculate the area of a circle and a flowchart to do the same. It then lists 5 exercises for students to write pseudocode and design flowcharts for algorithms to: 1) add two numbers, 2) convert temperatures between Fahrenheit and Celsius, 3) find the greater of two numbers, 4) calculate and display the area of a rectangle, and 5) find the largest of three numbers.

Uploaded by

Ainur Nasuha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Lab 2: Problem Solving using Algorithm

Objectives:

1. To illustrate algorithm before writing C++ program.


a. Design a simple algorithm using pseudocode
b. Design a simple algorithm using flowchart

Pseudocode
 A sequence of activities to be processed for getting desired output from a given input
 Before writing a pseudocode for a problem, one should find out what is/are the inputs and
what is/are expected output
 It uses short terms or simple English
 While writing pseudocode we will use following symbol for different operations:

“+” for Addition


“-” for Subtraction
“*” for Multiplication
“/” for Division
“ ” for assignment. For example, A x*3 means A will have a value
of x*3

 example pseudocode

Problem : Find the area of a Circle of radius r (A = r2)


Input : Radius r of the Circle
Expected Output : Area of circle

Pseudocode:

Start
1. Read/input/get the Radius r of the Circle
2. Area 3.14*r*r
3. Display Area
End
Flowchart
 A type of diagram that represents a workflow or process
 A flowchart can also be defined as a diagrammatic representation of an algorithm, a step-by-
step approach to solving a task
 Common flowchart symbols:

 Example flowchart

Problem : Find the area of a Circle of radius r (A = r2)

Start

Read r

Area = 3.14*r*r

Display Area
End
Exercises

Task 1: Write the pseudocode and design the flowchart to read two numbers and find their sum

Task 2: Write the pseudocode and design the flowchart to convert Fahrenheit to Celsius

Celsius = (F-32) x (5/9)

Task 3: Write pseudocode and design the flowchart to find the greater number between two numbers

Task 4: Write pseudocode and design the flowchart that display the area of a rectangle by accepting
length and width from the user.

Task 5: Write pseudocode and design the flowchart to find the largest value of any three numbers

You might also like