03 Principles of Programming and Problem Solving - Hsslive
03 Principles of Programming and Problem Solving - Hsslive
Computer can carry out tasks efficiently and accurately if we give correct instructions. Computer is an
obedient servant without any common sense. So the computer can be used to solve problems by giving step by
step instruction to solve it.
Top down Breaking the overall procedure in to modules and sub divide them until lowest level reached.
a). Problem Identification : To identify the data involved in processing, its types, formula to be used, activities
involve and the output to be obtained.
b). Preparing of Algorithms and flowchart: to develop a step by step procedure for problem solving.
f). Execution and testing : Running of the program and testing for correctness.
g). Documentation: It will help to understand the program for proper usage and modification.
Two types of documentations.
2) External Documentation: Writing manuals about the program for user help.
Computer program is a group of instructions written in a computer language in a particular order to solve a
problem.
Algorithm is a finite sequence of instructions to solve a problem. It is a step by step procedure to solve a problem.
It may contain input, processing , conditions and output statements. It follow the logical flow of the program. So
writing of program is easy with the help of flowchart.
6. What is a flowchart?
Flowchart is the pictorial representation of an algorithm with specific symbols for instruction. Here the
details of the elements in the programming language is not concerned. The symbols used in flowchart are,
HSSLIVE.IN Page 1
Terminal Process Decision
e). The total time taken to carry out all steps should be finite.
f). After performing the instructions, the desired output must be obtained.
a). Better communication: By using symbols, it is easy to convey ideas to other programmers.
b). Effective analysis: Because it clearly specifies the flow of steps in the program.
c). Effective synthesis: Program can be divided into small modules and its solution can represent separately and
can finally placed together.
d). Efficient Coding: The flow chart act as a road map through which the programmer can develop program with
out omission of important steps .
The algorithm which will be executed faster with minimum amount of memory space is considered a best
algorithm.
HSSLIVE.IN Page 2
12. What are different types of errors in computer programs?
a). Syntax error: Due to not following rules(syntax) of the programming language
Program written in any High Level Computer Language is known as Source Code.
The version of the source code get after translation is known as Object Code.
15. Write algorithm and flowchart to find sum and average of given 3 numbers.
Step 1. Start
Start
Step 2. Input num1, num2, num3
Step 3 sum=num1+num2+num3
Input
Step4 Avg=sum/3 num1,num2,num3
Avg=Sum/3
Sum, Avg
Stop
HSSLIVE.IN Page 3
16. Write algorithm and flowchart to find largest of given 3 numbers.
Step 4 print N1
Step 7 else
Step 8 print N3
If
Step 9 end if
N2>N2
Print N2
Step 10 Stop.
Print N2
Stop
17. Write algorithm and flowchart to find sum of first 100 odd numbers.
Step 4 count=count+1
Sum=Sum+ N
Step 5 N=N+2 Count=count+1, N= N+ 2
Print Sum
Stop
HSSLIVE.IN Page 4
18. Write algorithm and flowchart to find whether a given number is odd or even.
Step 1. Start
Start
Step 2. Input N
Step 4 If R = 0 then
R= N Mod 2
Step 5 print The Given number is even
Step 6 else
Stop
HSSLIVE.IN Page 5