0% found this document useful (0 votes)
3 views

CSC_Algo and Flowwork

The document explains algorithms and flowcharts, emphasizing their importance in problem-solving through sequential steps. It defines an algorithm as a clear, unambiguous set of instructions and describes flowcharts as visual representations of these algorithms. The document also outlines characteristics of both algorithms and flowcharts, provides examples, and includes exercises for practice.

Uploaded by

Shubham
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

CSC_Algo and Flowwork

The document explains algorithms and flowcharts, emphasizing their importance in problem-solving through sequential steps. It defines an algorithm as a clear, unambiguous set of instructions and describes flowcharts as visual representations of these algorithms. The document also outlines characteristics of both algorithms and flowcharts, provides examples, and includes exercises for practice.

Uploaded by

Shubham
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Algorithms and Flowcharts I

LEARNING OUTCOMES
The student will be able to:
• know about algorithms and flowcharts.
• write algorithms and draw flowcharts.

· steps m
In your daily life ' you carry ou t certam · order to perform a task and
· a sequent1al
get the desired result.
Let us und erstand the above statement with the help of the example given:
Process of Brushing Teeth
1. Take your brush from the shelf.
2. Turn on the tap of your wash basin.
3. Rinse the brush and turn off the tap.
4. Apply toothpaste on the brush.
5. Start brushing your teeth. •
6.
7.
Clean the brush and rinse your mouth.
Take your tongue cleaner. j
-
8. Clean your tongue.
9. Rinse your mouth again and clean your tongue cleaner.
10. Finally you get the desired result, i.e., shiny white teeth and a clean mouth.
Similarly, to solve any problem on a computer, you analyse and understand the nature
of the problem first. You plan the input and apply the appropriate methods, step-by-
step to get the desired result. This step-by-step procedure to solve any problem is called
Algorithm.

t) Algorithm
An algorithm is a set of sequential steps to solve any logical or mathematical problem. It
is always written in simple language and precise manner so that anyone can understand
the steps.

Characteristics of an Algorithm
Not all procedures can be called an algorithm. An algorithm should have the different
characteristics as listed on the next page.
lear and expllc,t. Each of
Unambiguous: An algorithm should be c
its steps should be clear and must lead to only one meaning.
bpla,n the process of Input: An algorithm should have well-defined input.
preparing a vegetable
sandwich. Output: An algorithm should have at least 1 well-defined output,
that should match the desired result.
Finiteness: An algorithm must terminate after a finite number of
steps.
Independent: An algorithm should have step-by-S t ep instructions,
which should be free from any programming code.
Consider the following examples to understand how to write

r
algorithms.
Example 1: Algorithm to set your school bag
Step 1: Start
Step 2: See the timetable.
Step 3: Go to your bookshelf.
Step 4: Take out the books and notebooks
according to the next day's schedule.
Step 5: Keep them in the bag.
Algorithms help you to Step 6: Close the bag.
understand the problems
and their solution in a Step 7: Stop.
better way.
Example 2: Algorithm to calculate the sum and average of three
numbers.
Step 1: Start
Step 2: Input first number (A).
Step 3: Input second number (B).
Step 4: Input third number (C).

li Step 5:
Step 6:
Step 7:
Find the sum of three numbers (A+B+C).
Find the average (A+B+C)/3.
Print Average.
Step 8: Stop

Example 3: Algorithm to compare two numbers and find the


greater one.
An algorithm means a Step 1: Start
precise rule (or a set of
rules) specifying how to Step 2: Input two numbers and store them in A and B.
solve some problems.
Step 3: Check whether A= B or not. If true then O to ste 4
else go to step 5. g P '

Cyber Quest I KwS


SteP ,4: Print ~Both numbers are eq ua l", and go to step 8.
Compare A and B If A is
sceP 5: . .. . · greater than B, go to step 6, else go to step 7.
steP 6: Pnnt A 1s greater", and go to step 8_
steP 7: Print "Bis greater", and go to step 8_
steP S: Stop
t) flowchart
Aflowchart is a pictorial representation of the steps of an algorithm used for solving a
particular pr~blem. To create a flowchart, different boxes are used that are connected to
each other w1th the help of flow lines.
characteristics of a Flowchart
<- Aflowchart should consist of standardised and acceptable symbols.
+ The symbols of a flowchart should be correctly used according to the rules.
+ Aflowchart should have short, clear, and readable statements written inside the
symbols.
+ Aflowchart must have a clear start and end.
<e Aflowchart must flow in a logical order.
<e Aflowchart should have suitable and common keywords such as READ, INPUT, PRINT,
WRITE, etc.
+ Aflowchart must have arrows indicating the flow of instructions.
Flowchart Symbols and their Functions
It is used at the beginning and the end of the flowchart.
( ) Start/Stop Box

Input/Output Box It is used for accepting input or giving output of the


L 1 program.

It is used for writing the processing instructions and doing


Processing Box
[ calculations.

It is used for checking or applying any condition in t he


Decision /
Condition Box program.

These arrows are used to connec t the vari ous geometrical


Flow Lines
symbols in a flowchart. Flow lines show the direction in
which the program is moving.

These are used to connect one part of the flowchart to


Connect ors
another.
of making tea.
Example 1: Write down the process
Start

Flowcharts are helpful Take a pan. water, sugar, tea


in analysing the logic of leaves, and milk.
a problem.

Put the pan on the gas burner and


pour water into it.

Turn on the gas burner.

Add some tea leaves when water


boils.

Know the Fact Add some sugar and milk.

Flowcharts assist in
finding and removing After it boils, take off the pan.
errors at different steps,
and in different phases of
the program. Strain it in a cup and serve the hot tea.

Stop

Example 2: Calculate the sum, difference, and product of two


numbers.

Know the Fact ( Start )


The general direction of
flow in any flowchart is
l
Input two numbers
from top to bottom, or
A and B.
from left to right.

Sum= A+ B

Print Sum

Difference = A - B

Know the Fact


Print Difference
• Flowcharts become
complex if the program
logic is complicated. Product = A • B
• You may be required
to draw the flowchart
Print Product
again If it needs
alterations.
Stop

Cyber Quest I KIPS


~ample 3: Draw a flowchart
nd B. to find the greater
J. a number among the two numbers

Start

Input A and B

No
Yes

No Both numbers
are equal

Bis
A is
greater than A
greater than B

Stop

AP .-- - - - - - - - -
• To solve any problem on a computer, you analyse and understand the nature of the
problem first.
• The step-by-step procedure to solve any problem is called Algorithm.
An algorithm should be clear and explicit.
An algorithm should be free from any programming code.
A flowchart is a pictorial representation of steps of an algorithm used for solving a
J>articular problem.
A flowchart should consist of st andardised and acceptable symbols.
flowchart should have short, clear, and readable statements written inside the symbols.
A. Fill in the blanks.

1. An .............................. 1s
. a set of sequent1a
- l step s that helps in solving a problem.
2. The.............................. bo x represents t he beg mmng or ending point of a program.

3. The .............................. box is used to enter data and give the result of a program.
4. The .............................. box is used to apply a condition in a program.
5. Th e .............................. are use to Jom one par o
d . . t f the flowchart to another.
1:tt33>
• Input/Output • Decision • Algorithm • Connectors • Start/Stop box

B. Write T f or True and F for False.

1. A flowchart is a chart representing a problem.


0
2. An algorithm means a set of rules, which specifies how to solve a problem.
3. Flowcharts are helpful in analysing the logic of a problem. □
4. Flow lines show the direction in which the program is moving.
LJ
5. The general direction of flow in any flowchart is from bottom to top or
D
right to left.

C. Select the correct option.

1. An algorithm is always written in ............................................. language.

a. Difficult b. Simple c. Binary


2. ............................................. box is used to display the final result.
a. Input/Output b. Stop
c. Processing
3. In a flowchart, ............................................. indicate the sequence of steps and direction of
flow.

a. Terminators
b. Connectors
c. Flow lines
4. The pictorial representation that illustrates the steps of the sotut · t bl • ll d
············································· . 1 on o a pro em 1s ca e
a. Algorithm
b. Flowchart
c. None

4 C I 4
1

CYber Quc-;t I K1PS


I t
Draw the flowchart symbols f
D, or the following .
start
I. ] A= A+ 1

1nputA, B I....._ _ _ _ _ _ _J] Print A

ls A> B
] Stop

E. Answer the following questions.

1. Define the term flowchart.

··································································································································································
························································· ····································································· ....................................
··································································································································································
2. What is an algorithm?

................................. ························ .........................................................................................................


.................. ...... ........ .... ..............................................................................................................................
................................................................................................................................................... ...............
3. What is the use of the decision box?

············································································ . .......................................................
··································································································································································
·················· ........................ ··························· ········· .................................................................·············· .... .
4. Distinguish between the flow lines and connectors.

···············································································
••••••••••••••••••••••••• •••••••••••••••••••••••••••••••• t •••••••••••••••••••••• • •••••••••••• • ••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••

••••••••••••••••••••••••••• •••••••••••••••••••• t •••••••••••••••••••••••••••••••••


I K&TriMirl'M
SECTION
Perfection Through Practice

A. Write algorithms for the following problems.


♦ To polish your shoes.
• To input three sides of a triangle and print if it is a scalene, an isosceles, or an equilateral
triangle.
• To find out the sum of the first 100 even numbers.
B. Monika wants to draw a flowchart to find the cube of a given number. Help her to
accomplish this task.
C. Make flowcharts for the following statements.
• Input the age of a person. Display the message 'Eligible For Role' if the age is equal to or
greater than 18, otherwise display the message 'Not Eligible'.
• Input a name. If the name is "Rohan", then accept marks. If marks are >=40, then display
'Pass ', else display 'Fail'.
♦ Input one character. Display the message 'Vowel' if the entered character is a vowel,
otherwise display the message 'Not a Vowel'.
♦ Input a year. Display the message 'Leap year' if the entered year has 366 days, otherNise
display the message 'Not a leap year'.

For Concept Clarity

Discuss the following topic:


+ Advantages of using Algorithms and Flowcharts

PROJECT WORK Using Creativity

Create a chart to depict the use of different flowchart symbols.

Looking for More

Use the following link to create flowcharts online:


https : / / app .creately.com/diagram/2ilgG1tmo5g / edit

~ --. Cyber Quest I KiP5


tititiru r•
Chapters 5- 9
~. fill in the blanks.
BY default, an Excel ......... .
1. ······················· holds a single worksheet.
2· Blocks in the ··························· ······ bl oc k category are round in shape.

3· ................................. is an effective way to display data in a graphical form.


4. The ................................. bar shows the characters and formulas that you enter in an active
cell.
5. ................................. are the highlighted text, buttons, or images in a website.

~ • Workbook • Formula • Links • Operators

B, Write T for True and F for False.

1. Adial-up connection is a high-speed internet connection. D


Scratch provides the facility to count the letters that are used to form a word. D
. The F12 key can be used to save the Excel file. D
• Amodem converts digital data into analog signals. D
• Select the correct option.
When you insert a chart, the data is displayed in a special window called ........................... .

a. Application b. Datasheet c. Report


The ........................... block category is used to create variables in the Scratch project.
b. Variables c. Pen

rosoft Excel, ........................... button is used to perform the addition of a range in a

b. AutoSum
c. Addition

se of radio frequency to connect to the internet and offers great


....... ma kes u

b. Satellite c. Hotspot
0 ITI;Q(0lrl~Ll\~[jjwl
Chapters 5-9
Name: ....................................... Date: .................................
A. Short-answer questions .

1. Which graphics tool in PowerPoint 2019 allows you


to present data or infor matio n with
graphics?

········•······························································································································
···························
2 · Name the block category which
contains blocks to solve mathematical equations.
·······································································································································
···························
3. What was the name of the first electronic spreadshee
t?

·······································································································································
··•························
B. Long-answer questions.

1. Why do you use conditions in programming?

................................................................................................................................................
..................

2. How many types of data can be entered in an Excel


sheet?

·······································································································································
···························
................................................................................................................................................
..................
3. What is the use of a Search Engine?

·······································································································································
···························
·······································································································································
···························
4. Write the use of Hotspot.

······························································ ········································································
····························
·······································································································································
···························

Teacher's Signature: .................................... .. .

Cyber Quest I KIPS

You might also like