Problem Solving by Programming

Filed under , on Sunday, January 24, 2010

1

We use computers to solve problems and perform calculations. However, in order to solve a problem using a computer, we must express the solution to the problem in terms of instructions necessary to solve the specific problem.

In other words, we have to provide the computer with a set of instructions to solve the problem at hand. This set of instructions is called a program. Once we write a program to solve a specific type of problem, it can be used again and again to solve the same type of problem.

For example, if we write a program to calculate the average of the marks obtained by 100 students in a class, the same program can be reused whenever we want to calculate the average of any set of 100 students.

Problem solving is an intricate process requiring thought, planning, logical precision, persistence and attention to detail.
The computer cannot be used to solve a problem until the programmer develops a method for the solution. This method or approach used solve a problem is called an algorithm.
The following steps are involved in solving a problem:
* Studying the problem in detail
* Gathering the relevant information
* Processing the information
* Arriving at the results

The above mentioned steps can be understood well with the following example.

For example, to check if a number is even or odd, the following steps are required:
* Read the number
* Divide the number by 2
* If the remainder of the division is zero, then the number is even
* Otherwise the number is odd

With these sequences of steps in hand, we can then proceed with expressing them in the statements of a particular programming language.

Although, there are so many programming languages today with different tools, name, syntax and way to use, they are all based on three primitive fundamental: sequence, branching and looping. Sequence means all program code always run from the first line to the last line of program code. Branching means program flow can jump or skip one or more lines of program code. Looping means program flow can repeat one or more lines of program code. These fundamental will be discussed more in the next week.

Comments Posted (1)

I just want to thank you for sharing your information and your site or blog this is simple but nice Information I’ve ever seen i like it i learn something today. Programming for Problem Solving

Post a Comment