Problem Solving Using Computer
Problem Solving Using Computer
Computer Programming
Karna Bahadur Shrestha
Problem analysis is the process of defining a problem and decomposing overall system into
smaller parts to identify possible inputs, processes and outputs associated with the problem.
Steps in problem analysis
1. Specifying the Objective :
First, we need to know what problem is actually being solved. Making a clear statement
of the problem depends upon the size and complexity of the problem. Smaller problems
not involving multiple subsystems can easily be stated and then we can move onto the
next step of “Program Design”. However, a problem interacting with various
subsystems and series of programs require complex analysis, in-depth research and
careful coordination of people, procedures and programs.
Step 1: Start
Step 2: Read principle (P), time (T) and rate (R)
Step 3: Calculate I = P*T*R/100
Step 4: Print I as Interest
Step 5: Stop
Flowcharting
Flowchart is basically a pictorial or diagrammatic representation of an algorithm using standard
symbols.
In other words, flowchart is a graphical representation that explains the sequence of operations to
be performed in order to solve a problem under consideration.
Advantages of Flowchart
Drawing flowchart while solving any problem has following advantages:
Effective Communication : Flowcharts are better way of communicating the logic of the system.
Effective Analysis : Using flowchart problem can be analyzed more efficiently.
Easy Debugging and Efficient Testing : The Flowchart helps in debugging and testing process.
Efficient Coding : The flowcharts are very useful during program development phase.
Proper Documentation : Flowcharts serves as a good program documentation, which is needed
for various purpose.
Efficient Program Maintenance : Maintenance of operating programs becomes easy with the
help of flowchart.
Disdvantages of Flowchart
Flowchart has following disadvantages:
Complex Logic: For complicated logic, flowchart becomes complex and clumsy.
Difficulty in Modifications: If change is required in the logic then flowchart needs to be redrawn
and requires a lot of time.
int main()
int length,breadth,area;
scanf("%d %d",&length,&breadth);
area=length*breadth;
return 0;
A source code must go through several steps before it becomes an executable program. In the
first step the source code is checked for any syntax errors. After the syntax errors are traced out a
source file is passed through a compiler which first translates high level language into object
code (A machine code not ready to be executed). A linker then links the object code with pre-
compiled library functions, thus creating an executable program. This executable program is then
loaded into the memory for execution. General compilation process is shown in Figure below:
Debugging is the process of finding errors and removing them from a computer program,
otherwise they will lead to failure of the program. Even after taking full care during program
design and coding, some errors may remain in the program and these errors appear during
compilation or linking or execution. Debugging is generally done by program developer.
Testing is performed to verify that whether the completed software package functions or works
according to the expectations defined by the requirements. Testing is generally performed by
testing team which repetitively executes program with intent to find error. After testing, list of
errors and related information is sent to program developer or development team.
Documentation
The program documentation is the process of collecting information about the program. The
documentation process starts from the problem analysis phase to debugging and testing.
Documentation consists two types of documentation, they are:
User documentation is required for the end user who installs and uses the program. It consists
instructions for installation of the program and user manual.