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

What is Problem Solving in Programming

Uploaded by

wardaaamir062
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views

What is Problem Solving in Programming

Uploaded by

wardaaamir062
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Lecture #01 Problem Solving

What is Problem Solving in Programming?

Computers are used to solve various problems in day-to-day life. Problem Solving is an
essential skill that helps to solve problems in programming. There are specific steps to be
carried out to solve problems in computer programming, and the success depends on how
correctly and precisely we define a problem. This involves designing, identifying and
implementing problems using certain steps to develop a compute

Steps Involved in Problem Solving

Before being ready to solve a problem, there are some steps and procedures to be followed to
find the solution. Let's have a look at them in this problem solving in programming article.

Basically, they are divided into four categories:

 Analysing the problem

 Break up the problem into simple manageable sub-problems.

 Developing the algorithm

 Coding

 Testing and debugging

1.Analysing the Problem

Every problem has a perfect solution; before we are ready to solve a problem, we must look
over the question and understand it. When we know the question, it is easy to find the
solution for it. If we are not ready with what we have to solve, then we end up with the
question and cannot find the answer as expected. By analysing it, we can figure out the
outputs and inputs to be carried out. Thus, when we analyse and are ready with the list, it is
easy and helps us find the solution easily.

2. Break the problem


After you’ve understood the problem at hand, break it down into simple sub problems again
and again until you know how to solve it and write the solution. With simple manageable sub
problems you’ll be in a good position to solve the entire problem. You can start from the big
picture then break down the problem into smaller constituent chunks. This is called the top
down approach.

3. Developing the Algorithm

It is required to decide a solution before writing a program. The procedure of representing the
solution in a natural language called an algorithm. We must design, develop and decide the
final approach after a number of trials and errors, before actually writing the final code on an
algorithm before we write the code. It captures and refines all the aspects of the desired
solution.

An algorithm can be presented in different ways; pseudo code, flowcharts, decision tables etc.
To give you an example of an algorithm, lets take an example of a program that adds two
numbers. An algorithm for such a program could be as follows:

1. Start

2. Create three variables x, y, and sum.

3. Ask user to enter two numbers.

4. Store the numbers in variable x and y.

5. Add x and y and store value in sum.

6. Print sum.

7. Stop.

4. Coding

Once we finalise the algorithm, we must convert the decided algorithm into a code or
program using a dedicated programming language that is understandable by the computer to
find a desired solution. In this stage, a wide variety of programming languages are used to
convert the algorithm into code.

Once you have your algorithm, its time for the real fun; coding. Start by handling small pieces

of your problem first and combine them to form a solution to the large piece.
For instance, for our addition algorithm above, you can start by tackling the step 2 (create

variables x, y, and sum). Next, ask the user to enter the numbers to add and so on.

5. Testing and Debugging

The designed and developed program undergoes several rigorous tests based on various real-
time parameters and the program undergoes various levels of simulations. It must meet the
user's requirements, which have to respond with the required time. It should generate all
expected outputs to all the possible inputs. The program should also undergo bug fixing and
all possible exception handling. If it fails to show the possible results, it should be checked
for logical errors.

Industries follow some testing methods like system testing, component testing and acceptance
testing while developing complex applications. The errors identified while testing are
debugged or rectified and tested again until all errors are removed from the program.

You might also like