×

Close

- Problem Solving And Programming In C - PSPC
- Note
- 8 Topics
**8768 Views**- 279 Offline Downloads
- Uploaded 1 year ago

Touch here to read

Page-1

Topic:

UNIT 1 Introduction to Problem Solving Techniques Structure 1.0 Introduction 1.1 Procedure (steps involved in problem solving) 1.2 Algorithm 1.3 Flow Chart 1.4 Symbols used in Flow Charts 1.5 Pseudo Code Learning Objectives • To understand the concept of Problem solving • To understand steps involved in algorithm development • To understand the concept of Algorithm • Develop Algorithm for simple problem • To understand the concept of Flowchart development • Draw the symbols used in Flowcharts

250 Computer Science and Engineering 1.0 Introduction A computer is a very powerful and versatile machine capable of performing a multitude of different tasks, yet it has no intelligence or thinking power. The intelligence Quotient (I.Q) of a computer is zero. A computer performs many tasks exactly in the same manner as it is told to do. This places responsibility on the user to instruct the computer in a correct and precise manner, so that the machine is able to perform the required job in a proper way. A wrong or ambiguous instruction may sometimes prove disastrous. In order to instruct a computer correctly, the user must have clear understanding of the problem to be solved. A part from this he should be able to develop a method, in the form of series of sequential steps, to solve it. Once the problem is well-defined and a method of solving it is developed, then instructing he computer to solve the problem becomes relatively easier task. Thus, before attempt to write a computer program to solve a given problem. It is necessary to formulate or define the problem in a precise manner. Once the problem is defined, the steps required to solve it, must be stated clearly in the required order. 1.1 Procedure (Steps Involved in Problem Solving) A computer cannot solve a problem on its own. One has to provide step by step solutions of the problem to the computer. In fact, the task of problem solving is not that of the computer. It is the programmer who has to write down the solution to the problem in terms of simple operations which the computer can understand and execute. In order to solve a problem by the computer, one has to pass though certain stages or steps. They are 1. Understanding the problem 2. Analyzing the problem 3. Developing the solution 4. Coding and implementation. 1. Understanding the problem: Here we try to understand the problem to be solved in totally. Before with the next stage or step, we should be absolutely sure about the objectives of the given problem. 2. Analyzing the problem: After understanding thoroughly the problem to be solved, we look different ways of solving the problem and evaluate each

Paper - II Programming in C 251 of these methods. The idea here is to search an appropriate solution to the problem under consideration. The end result of this stage is a broad overview of the sequence of operations that are to be carries out to solve the given problem. 3. Developing the solution: Here the overview of the sequence of operations that was the result of analysis stage is expanded to form a detailed step by step solution to the problem under consideration. 4. Coding and implementation: The last stage of the problem solving is the conversion of the detailed sequence of operations in to a language that the computer can understand. Here each step is converted to its equivalent instruction or instructions in the computer language that has been chosen for the implantation. 1.2 Algorithm Definition A set of sequential steps usually written in Ordinary Language to solve a given problem is called Algorithm. It may be possible to solve to problem in more than one ways, resulting in more than one algorithm. The choice of various algorithms depends on the factors like reliability, accuracy and easy to modify. The most important factor in the choice of algorithm is the time requirement to execute it, after writing code in High-level language with the help of a computer. The algorithm which will need the least time when executed is considered the best. Steps involved in algorithm development An algorithm can be defined as “a complete, unambiguous, finite number of logical steps for solving a specific problem “ Step1. Identification of input: For an algorithm, there are quantities to be supplied called input and these are fed externally. The input is to be indentified first for any specified problem. Step2: Identification of output: From an algorithm, at least one quantity is produced, called for any specified problem. Step3 : Identification the processing operations : All the calculations to be performed in order to lead to output from the input are to be identified in an orderly manner. Step4 : Processing Definiteness : The instructions composing the algorithm must be clear and there should not be any ambiguity in them.

252 Computer Science and Engineering Step5 : Processing Finiteness : If we go through the algorithm, then for all cases, the algorithm should terminate after a finite number of steps. Step6 : Possessing Effectiveness : The instructions in the algorithm must be sufficiently basic and in practice they can be carries out easily. An algorithm must possess the following properties 1. Finiteness: An algorithm must terminate in a finite number of steps 2. Definiteness: Each step of the algorithm must be precisely and unambiguously stated 3. Effectiveness: Each step must be effective, in the sense that it should be primitive easily convert able into program statement) can be performed exactly in a finite amount of time. 4. Generality: The algorithm must be complete in itself so that it can be used to solve problems of a specific type for any input data. 5. Input/output: Each algorithm must take zero, one or more quantities as input data produce one or more output values. An algorithm can be written in English like sentences or in any standard representation sometimes, algorithm written in English like languages are called Pseudo Code Example 1. Suppose we want to find the average of three numbers, the algorithm is as follows Step 1 Read the numbers a, b, c Step 2 Compute the sum of a, b and c Step 3 Divide the sum by 3 Step 4 Store the result in variable d Step 5 Print the value of d Step 6 End of the program 1.2.2 Algorithms for Simple Problem Write an algorithm for the following 1. Write an algorithm to calculate the simple interest using the formula. Simple interest = P*N* R/100.

## Leave your Comments

## Sai priya Dubala

2 months ago00## Aprajita Singh

8 months ago00## SAVITHA B

9 months ago01