GET EDUCATE

Contents
Basics of C Programming

⯈Basic C Programs

Introduction to problem solving

Problem solving is one of the most important areas of the computer science. We write computer programs or develop software to solve real world problems. There are various steps that we take care when we solve the problem. Problem solving includes:

  1. Analysis of problem.
  2. Developing an efficient algorithm.
  3. Implementing the algorithm (writing program).
  4. Testing the program against all possible valid inputs. 

1. Analysis of problem:

The analysis of the problem includes knowing what inputs the program takes and what output the program gives. Inputs are also known as the “knowns” of the problem and output are “unknowns”.

2. Developing an efficient algorithm:

Before we write the program, we write solve the problem in step-by-step manner in natural language. There may be more than one solution for a given problem which we analyze and select the best solution. Here we may also write the flowchart which says the flow of control of the program in diagrammatic form.

How do we write an algorithm in step-by-step manner we will discuss in the next section.

3. Implementing the algorithm:

In this step we write the program for the algorithm which we have selected. Algorithm is in natural language steps, and a computer can only understand the binary language. Here we convert the natural language into a coding language, usually a high-level language like C, C++, Python, Java, etc.,

We will discuss in detail about the C Programming language in this tutorial.

4. Testing the program:

After we write the program, we need to check whether the program is giving answer as desired for all possible inputs. If yes, then the program which we have written is correct else we need to change the logic and rewrite the algorithm and program. 

To test the program, we can do dry run of the program, executing it manually step by step to check for the output.

The steps of the problem-solving forms a cycle. If the test results are not correct or we need to improve the algorithm on its efficiency, then we redo all the steps starting from the analysis. 

The following diagram describes the problem-solving cycle.

problem solving steps
problem solving steps
Scroll to Top