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

COMPUTERS IN

MATHEMATICS

(SENIOR SECONDARY)
PRESENTATION BY
CHIPESHA .D (KAPTECH) DATA
ALGORITHMS AND FLOWCHARTS

Computer programmers plan instructions or programmes(series of instructions or


codes given to a computer to perform a task) in form of Algorithms e.g Flow
charts and Pseudo codes.
i. Algorithms – This is a step by step procedure for performing a given task or
solving a particular problem. This can either be in form of ordinary language
(Pseudo codes ) or boxes of various kinds joined together by lines (Flow
charts).
ii. Flow charts – This is a diagram that represents a process of a programme as
boxes of various kinds which are joined by lines. All boxes used in a flow chart
have specific meanings as shown below :
TYPES OF BOXES USED IN A FLOW CHART
1. Used for start/begin/ stop or end.

2. Used for input/enter / output or display.

3. Used for a decision ( Yes/no or True or False)

4.
Used for an action , a process or to enter formulas.
.
EXAMPLE
1. Study the flowchart and answer the questions that follow: SOLUTION

START INPUT N INPUT N OUTPUT C

55 0.55 2

2100 0.21 4
C=1

1 0.1 1

INPUT N

yes

  N= STOP
OUTPUT C

no
C = C+1
EXERCISE
1. Study the flow chart below and complete the table that it is given.
Start

INPUT x INPUT x OUTPUT s


S=1

48 0.48 2

INPUT x 9170 0.917 4

- 800 - 80 1
  X=

IS
OUTPUT STOP
x<1 ?
S

S = S+1
EXERCISE 2
1. The flow chart below is used to determine whether a particular year is a leap
year or not. Use it to determine whether the following years where leap years.

a) 1964
b) 1970
c) 2018
d) 2020
START
solutions….
GET A
YEAR
a) 1964 – It is a leap
year IS IT No
DIVISIBLE
b) (b) 1970 not aleap BY 4?

year Yes

c) (c) 2018 not a leap IS IT


No
DIVISIBLE
year BY 100?
d) .(d) 2020 leap year. Yes
IS IT No
DIVISIBLE OUTPUT NOT
BY 400 ? LEP YEAR

Yes

LEAP
STOP
YEAR.
PSEUDO CODES
• A pseudo code is a programme design language that is made up of statements that are
written in natural language. It is structured English that is used as an alternative method
to flow charts. There are three structures that can be used :
i. Structures consisting of simple steps that are carried out one after another without
loops or decision boxes.
ii. One which has decision structures. Decision structures occur when a question is asked
the answer ( yes\no). In this case the words like If, Then , Set and End are used.
iii. Loops structures are used when actions are repeated for a number of steps , words to
use are DO UNTIL, DO WHILE etc.
EXAMPLE
1. Draw a corresponding flow chart for the programme below in form of a
pseudo code.
Continued….
•  
Begin
Enter radius < 0
then display “ error message “
and re-enter positive radius
enter height
If height < 0
then display ‘’ error message’’
and re-enter positive radius
else volume = * square radius * height
end if
Display volume
End
SOLUTION
BEGIN

Enter
radius

Display YES is Radius


error and re- <0?
enter
positive No
radius Enter
Height

YES
Display error is Height< 0?
message and
re-enter No
positive   V = * square radius * height
thought

Display
volume

END
EXERCISE
•   Draw a corresponding flow chart for the programme below in form of a pseudo
1.
code.
Start
Enter diameter
If diameter < 0 then display error message and stop
Circumference = * diameter
End if
Display circumference
Stop
SOLUTION
START

ENTER
DIAMETE
R

IS Yes Display error


DIAMETER message
< 0?

No

  C = * diameter

DISPLAY
CIRCUMFERENCE STOP
EXERCISE 2
• Construct a flow chart to calculate the area of a circle.
SOLUTION
Begin.

ENTER r

Yes Display
IS r ≤ 0? error
message

No

  A = * square radius

DISPLAY A

Stop
WRITING A PSEUDO CODE
• A pseudo code is a derivative of a flow chart and only words are used to write a
pseudo code. Each and every flow chart has its representative pseudo code.
EXAMPLES
1. The programmes below are given in form of flow charts. Write down pseudo
codes corresponding to each of the given flow charts.
START

ENTER a , b

Yes Display error


Is a = 0 ?
message

No

  SET X =

DISPLAY x

STOP
START

ENTER a , r

No Display
Is |r| less
error
than < 1?
message

YES
  S∞ =

Display sum
to infinity

STOP
•a. Start
enter a , b
if a = 0, display error message and stop
else, set X=
End if
Display x
Stop
b. Start
enter a, r
if |r| ≥ 1, display error message and stop
else if |r| < 1, then
Set ∞ =
End if
Display sum to infinity
Stop
EXERCISE

1.The programmes below are given in


form of flow charts. Write down the
pseudo codes corresponding to each
of the given flow chart.
START NO

DISPLAY   SET V= * square radius * height


ENTER
ENTER r
MESSAGE
AND RE-
DISPLAY
ENTER
VOLUME
POSITIVE
• YES
MESSAGE Is radius < 0
• STOP
NO

DISPLAY ENTER
ERROR HEIGHT
MESSAGE
AND RE-
ENTER
POSITIVE YES IS HEIGHT
HEIGHT < 0?
START

 
X1 =
Enter a ,b , c
X2 =

D = b*b - 4*a*c
Print x1 and x2

YES Display
Is D<0? no
STOP
solution

NO
SOLUTIONS

•1.  Start

enter radius
if radius < 0 display error message and re-enter positive radius .
else, enter height < 0 display error message and re-enter positive radius
then set V = ** square radius * height
display volume
stop
•  
2. Start

enter a , b and c
set D = b*b – 4 * a * c
if d < 0, display no solution and stop
else, set X1 = , X2 =
end if
Print X1 and X2
stop
THE END!
Thank you for your Attention.

You might also like