Algorithm and Flowchart
Algorithm and Flowchart
and Flowchart
What is an algorithm?
An algorithm describes
the step by step action to
solve a problem..
What is an algorithm?
An algorithm is a self-contained step-by-
step set of operations to be performed to
solve a specific problem or a class of
problems.
2. Write an algorithm15
to change a numeric
grade to a pass/fail grade.
Example of an algorithm
Solution # 2
Pass/Fail Grade
Input: One number
if (the number is greater than or equal to 50)
then
1.1 Set the grade to “pass”
else
1.2 Set the grade to “fail”
End if
Print the grade
End
Example of an algorithm
ON PAGE CONNECTOR
OFF PAGE
CONNECTOR
Flowchart or program constructs
Sequence: The order of execution, this
typically refers to the order in which the
code will execute. Normally code
executes line by line, so line 1 then 2
then 3 and so on.
Algorithm
Step 1: Start
Step 2: Take Width and Length as input
Step 3: Calculate Area by Width* Length
Step 4: Print Area.
Step 5: End
START
Step 1: Start
Input
Step 2: Input W, L W, L
Step 3: A = L x W
Step 4: Print A A = Lx W
Step 5: End
Print
A
END
Write an algorithm and draw a flowchart
that will take marks of four subjects and
calculate the average. Then if average
marks are greater than 50 then print
PASS otherwise print FAIL.
START
else
AVG<50
Print “PASS”
Print
“PASS”
Print
“FAIL”
endif
Step 5: End
END
Write an algorithm and draw a
flowchart to convert the length in feet
to centimeter.
Flowchart
Algorithm START
Step 1: Start
Input
Step 2: Input ft ft
Step 3: cm = ft * 30
cm = ft x 30
Step 4: Print cm
Step 5: End
Print cm
END
THANK YOU!!!