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

Planning the computer Program

The document outlines the process of planning a computer program, emphasizing the importance of algorithms, flowcharts, and pseudocode in problem-solving. It details the steps involved in programming, including defining the problem, creating algorithms, and using flowcharts for visualization and communication. Additionally, it discusses the advantages and limitations of using algorithms and flowcharts in programming.

Uploaded by

suaibalislam1a2
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

Planning the computer Program

The document outlines the process of planning a computer program, emphasizing the importance of algorithms, flowcharts, and pseudocode in problem-solving. It details the steps involved in programming, including defining the problem, creating algorithms, and using flowcharts for visualization and communication. Additionally, it discusses the advantages and limitations of using algorithms and flowcharts in programming.

Uploaded by

suaibalislam1a2
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 26

Planning the Computer Program

Program:
▪ A Program is a set of step-by-step instructions that directs the computer to do the tasks you
want to do and produce the results you want.

Whay Learn programming:


▪ To enhance our skills
▪ Helps us to understand about computer
▪ Increase confidence level
▪ Makes complex problem to be solve easily
▪ Make easier to work ewith different people
▪ Makes how to think and solve problem
Purpose of Program Planning
Problem solving with computer involve several steps:
▪ Clearly define the problem. (Validation)
▪ Analyze the problem and formulate a method to solve it. (Validation)
▪ Describe the solution in the form of an algorithm.
▪ Draw a flowchart of the algorithm
▪ Write the computer program
▪ Compile and run the program
▪ Test the program (Verification)
▪ Interpretation of result (Verification)
Planning the Computer Program
Algorithm:
▪ Refers to the logic of a program
▪ It is a procedure consisting of a finite set of unambigous instructions which specify a finite
sequence of operations that provides the solution to problem.

Characteristics of an algorithm:
▪ Each instructions should be precise and unambigous
▪ Each instructions should be executed in a finite time
▪ No instructions should repreat infinitely. This ensure that the algorithm terminates ultimately.
▪ After executing the instruction, the desired result are obtained.
Advantages of an Algorithm
Three reasons for using algorithms are efficiency, abstraction and reusability.
Efficiency: Efficient algorithms must be used to solve such problems considering the time and
cost factor involved in each algorithm.
Abstraction: Algorithms provide a level of abstraction in solving problems because many
complicated problems can be extracted into simpler ones for which well-known algorithms
exist. Once we see a more complicated problem in a simpler light, we can think of the simpler
problem as just an abstraction of the more complicated one.
Reusability: Algorithms are often reusable in many different situations. Since many well-known
algorithms are the generalizations of more complicated ones, and since many complicated
problems can be extracted into simpler ones, an efficient means of solving certain simpler
problems potentially lets us solve many others.
Example of an Algorithm
Example: Write an algorithm to read two numbers and find their sum.

Solve:
Step1: Start
Step2: Read the first number1
Step3:Read the second number
Step4: sum=number1+number2
Step5: Print sum
Step6: END
Example of an Algorithm
Solution of Example of an Algorithm
Representation of Algorithm
There are various way in which algorithm can be represented. Programmer normally use one or more of the
following ways to represent their algorithm

1. Programs
2. Flowchart
3. Pseudocode
Flowchart
Flowchart is a graphical or symbolic representation of an algorithm. It is the diagrammatic
representation of the step-by-step solution to a given problem.
When to Use a Flowchart:
▪ A flowchart is generally used when a new project begins in order to plan for the project.
▪ A flowchart helps to clarify how things are currently working and how they could be improved. It
also assists in finding the key elements of a process, while drawing clear lines between where one
process ends and the next one starts.
▪ Developing a flowchart stimulates communication among participants and establishes a
common understanding about the process. Flowcharts also uncover steps that are redundant or
misplaced.
▪ Flowcharts are used to help team members, to identify who provides inputs or resources to
whom, to establish important areas for monitoring or data collection, to identify areas for
improvement or increased efficiency, and to generate hypotheses about causes.
▪ It is recommended that flowcharts be created through group discussion, as individuals rarely
know the entire process and the communication contributes to improvement.
▪ Flowcharts are very useful for documenting a process (simple or complex) as it eases the
understanding of the process.
▪ Flowcharts are also very useful to communicate to others how a process is performed and enables
understanding of the logic of a process.
Advantages of Using Flowcharts:
The benefits of flowcharts are as follows:
▪ Communication: Flowcharts are better way of communicating the logic of a
system to all concerned.
▪ Effective analysis: With the help of flowchart, problem can be analysed in
more effective way.
▪ Proper documentation: Program flowcharts serve as a good program
documentation, which is needed for various purposes.
▪ Efficient Coding: The flowcharts act as a guide or blueprint during the
systems analysis and program development phase.
▪ Proper Debugging: The flowchart helps in debugging process.
▪ Efficient Program Maintenance: The maintenance of operating program
becomes easy with the help of flowchart. It helps the programmer to put efforts
more efficiently on that part.
Limitations of Using Flowcharts:
▪ Complex logic: Sometimes, the program logic is quite complicated. In
that case, flowchart becomes complex and clumsy.
▪ Alterations and Modifications: If alterations are required the flowchart may
require re-drawing completely.
▪ Reproduction: As the flowchart symbols cannot be typed, reproduction of
flowchart becomes a problem.
▪ Time consuming, There is no well standard
Flowchart Symbols & Guidelines:
Flowcharts are usually drawn using some standard symbols; however, some
special symbols can also be developed when required. Some standard symbols,
which are frequently required for flowcharting many computer programs are
shown.
Terminator: An oval flow chart shape indicates the start or end of the process,
usually containing the word “Start” or “End”.

Process: A rectangular flow chart shape indicates a normal/generic process flow step. For
example, “Add 1 to X”, “M = M*F” or similar.
Flowchart Symbols & Guidelines:
Decision: A diamond flow chart shape indicates a branch in the process flow. This symbol
is used when a decision needs to be made, commonly a Yes/No question or True/False test.

Connector: A small, labelled, circular flow chart shape used to indicate a jump in the
process flow. Connectors are generally used in complex or multi-sheet diagrams.

Data: A parallelogram that indicates data input or output (I/O) for a process. Examples: Get X
from the user, Display X

Arrow: used to show the flow of control in a process. An arrow coming from one symbol
and ending at another symbol represents that control passes to the symbol the arrow points to.
Flow Chart Rulse:
Example of Flowchart :
Example of Flowchart :
Example of Flowchart :
Example of Flowchart :
Pseuducode:
1. Sequence Logic:
2. Selection Logic:
3. Iteration Logic:
Example of Pseuducode:
If student's grade is greater than or equal to 60
Print "passed"
else
Print "failed"
endif
Advantage of Pseuducode:
Limitation of Pseuducode:

You might also like