You are on page 1of 6

COMPUTERS

- What is a computer?
- Accept data, as input
- Process the data
- Store data and information
- Produce information, as output.

BASIC ELEMENTS OF A COMPUTER


INPUT PROCESS OUTPUT
STORAGE

- Input parts/devices
Examples include Keyboard, mouse etc.
- Process part/device
For example CPU or Systems Unit.
- Output parts/ devices
Examples include Monitor, Printer etc.
- Storage parts/devices
For example Flash disk, Memory card etc.

ALGORITHMS.
- A flow chart can be considered as an example of an Algorithm
Definition
- An algorithm is generally a set of logical steps that need to be followed in order to solve a
problem.
- For example the solving of a malaria problem using any anti-malaria drug.

METHODS OF IMPLEMENTING AN ALGORITHM.


- There are two basic methods of implementing an algorithm and these are:
(i) FLOW CHARTS
(ii) PSEUDO CODE

 FLOW CHARTS
- The underlying factors of any flow chart are the use of the correct symbols for each step
and the correct operation symbols.
- BEGIN
For example; calculate how far point A is from CBU, given point A.
-
ENTER Point A

ERROR: Point A
Is Point A MUST BE OUTSIDE
within CBU? CBU

Measure the distance


between them.

DISPLAY
DISTANCE

END

- This is a derivative of a flow chart and its underlying factors are the correct extraction of

statements inside a flow chart symbol, listing them vertically and preservation of the

logical steps also known as dentation.

- For example; An equivalent Pseudo code to the flow chart above is:
EQUIVALENT PSEUDO CODE

BEGIN
ENTER Point A,
IF Point A is within CBU THEN
DISPLAY Error message,
ENTER Point A,
ELSE
Measure Distance between them,
ENDIF
DISPLAY Distance,
END.

We conclude this topic by solving a quadratic equation using a flow chart and a corresponding
pseudocode.

We also note that the equation ax2 +bx+c=0 can only be solved if the Discriminant, D=b 2-4*a*c>0(or
D>=0), that is D must not be negative (we are not dealing with complex numbers).so the above equation
will have no solutions if D<0. We also note that the inequality D<=0 will not hold and so cannot be used.

Example

Write a flow chart and a corresponding pseudo code to find the solution of the equation ax 2 +bx+c=0

Solution

a) Flow chart
b) Pseudocode

Start

Enter the values a, b, c

Let D=b*b-4*a*c

If D<0 Then

Print “imaginary roots”

If D>=0 Then

X1= (-b+sqrt (d))/ (2*a)

X2= (-b-sqrt (d))/ (2*a)

Print x1, x2

End .
FLOW CHARTS CONSTRUCTION
- A computer carries out all its tasks in a logical way.
- A set of logical steps that need to be followed in order to solve a problem are also
referred to as FLOW CHART.
How does one construct a flow chart?

- To construct a flow chart one needs to firstly master the symbols used and their meaning.

BASIC FLOWCHART SYMBOLS

SYMBOL MEANING
BEGIN/END OR
START/ STOP
INPUT/OUTPUT OR ENTER
/DISPLAY

PROCESS

DECISION

PROGRAM FLOW

BASIC FOUR OPERATORS

SYMBOL MEANING

ADDITIONAL
+
SUBTRACTION

MULTIPLICATION
*
DIVISION
/

For more information>>>>>>>>>>>>>>> visit https://www.google.co.zm/search?


q=flowchart+and+pseudocode+for+quadratic+equation&rlz=1C1NDCM_enZM771ZM771&tbm=isch&so
urce=iu&ictx=1&fir=wXk_GJ9EC4trrM%253A%252CtY2X41Nz3TqtJM%252C_&usg=__H-
NmsTi8Cq6eJMcVSx-w1wGCRGE
%3D&sa=X&ved=0ahUKEwig49bFy43cAhUmC8AKHdW7BKAQ9QEIKTAA#imgrc=a33WoT4fb8ntCM:

You might also like