Sequential Processes

You might also like

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 22

Understanding Sequential Processes and Creating Flowcharts

for Sequential Processes


Watch the following video about sequence

https://www.youtube.com/watch?
v=v_Pc3UnePZY&list=PL8HZ0pojM34Xkz7Yh7JxoSRytoa8FR7gV
Discussion
● Provide examples of common sequential processes in your daily life and programming.

● Explain the importance of following a step-by-step order in various activities/significance of


sequential processes in programming and everyday tasks.
Arithmetic operators
Steps in calculating the sum and average of two numbers (Writing algorithm)

Step 1: Start
Step 2: Input the first number num1.
Step 3: Input the second number num2.
Step 4: Add num1 and num2 and store the result in a variable ‘sum’.
Step 5: Divide sum by 2 and store the result in a variable ‘average’.
Step 5: Display the value of sum and average.
Step 6: Stop

https://www.youtube.com/watch?v=b9EYDCcB2Sk
Draw a flowchart to calculate the sum and average of two numbers
Step 1: Start
Write an algorithm to find area of a Square.

Step 2: Input the side length of the square (side_length)


Step 3: Compute the area of the square using the formula:
area = side_length * side_length
Step 4: Display the computed area
Step 5: Stop

https://www.youtube.com/watch?v=ID1hj6J0Dys
Draw a flowchart to find area of a Square.
HW
1) Draw a flowchart to find out the product of two numbers.
2) Draw a flowchart to find out the area of a square.
3) Draw a flowchart to find out the average of two numbers.
4) Draw a flowchart to find out the perimeter of a rectangle.
5) Draw a flowchart to find out the remainder when 11 is divided by 3.
A sample flowchart
Write an algorithm to find out the greatest of two numbers

1.Start
2.Input the first number and store it as num1.
3.Input the second number and store it as num2.
4.If num1 is greater than num2, then set the value of num1 as the greatest number.
Go to step 6.
5.Otherwise (if num2 is greater than or equal to num1), then:
set the value of num2 as the greatest number.
6.Display the greatest number.
7.Stop
Draw a flowchart to find out the greatest of two numbers
Relational operators
Data Types
Data type is used to define the type of value a data can contain. It represents what kind of
operation can be done on a particular data. Data types define the way to store values in the
memory.
INTEGER
Integers are the whole numbers consisting of + or - sign without decimal point such as 1000, -88, etc.
Example: >>> a=12 # This is a positive integer value
>>> b=-20 # This is a negative integer value

FLOAT
Float data type represents floating point numbers which contain decimal point. For example, 0.5,
-4.567, 0.001, etc.
Example: >>> a=12.5 # This is a float value
>>> b=12 # This is an integer value

STRING
String is a sequence of characters (alphabets, numbers, operators and punctuation) used to store and
represent text-based information. Single quotes ('') and double quotes (" ") are used to represent strings
in Python.
Example: >>> name="reema“ # name stores a string
>>> password= 'reema@123’

You might also like