## Problem Solving

A problem is a situation that requires attention to solve it. Sometimes we face different problems. In which some are very difficult and some are easy. A well-organized approach identifies the problem and develops, the best solutions to solve them. We use different strategies and tools to solve problems in which we used the computer as a tool to solve complex problems. Computer work on instructions and a programmer give instructions to the computer and computer execute them to solve problems.

Different Problem-solving techniques:

- Program
- Algorithm
- Flowchart

Introduction to Programming Program, Algorithm, and Flowchart

Introduction to Programming Program, Algorithm, and Flowchart |

**Program**

A program is a set of instructions given to the computer to solve a specific problem. A programmer gives instructions according to the problem and the computer executes them to solve the problem. There are different programming languages that the programmers use in which as C++, Java, SQL, Python, etc.

**Advantages of Computer Programs**

There are different types of advantages let see:

- Computer programs used to solve different types of problems
- After executing the program get the result quickly
- Execute one program many times
- Display result in different styles
- Make your work easy and safe time
- In every field, computer program are used to perform differently types of tasks.
- In our daily life computer, the program makes our lives easy

**Algorithms**

Algorithms are used before writing a program. It is an easy way to write a program and solve the problem. Before writing a program make algorithms about it and then start writing the program. It is a simple way to write a program and less time-consuming.

### Properties of Algorithm

There are some properties of the algorithm let see:

- Broken the problem in simple, meaningful steps
- Steps are in numbered sequence
- Steps were written in simple English

**Now,** let’s see the different types of algorithms used in computer programming to solve different types of problems:

**1.** 1. **Algorithms to find the sum, product, and average of three numbers.**

Input three numbers a, b, c

If we calculate Sum = a + b + c

If we calculate product = a * b * c

If we calculate average = sum / 3

**2.** 2. **Algorithm to find volume of a sphere**

Input radius R

Pie = 3.14

Calculate Volume = 4 / 3 * pie * R * R * R

Result Volume

**3** 3. **Algorithm converts the temperature form Celsius to Fahrenheit**

Input temperature in (temp) and option in (op)

If op = 1

Calculate r = 9 / 5 * temp + 32

Else

Calculate r = 5 / 9 * (temp – 32)

Result r

**4** 4. **Algorithm finds the factorial of a number**

Input number n

Fact = 1, c = 1

Repeat 4.1 to 4.2 While c <= n

4.1: Fact = fact *c

4.2: Increment c = c + 1

Result Fact

**Advantages of Algorithms**

There are some advantages of using algorithms let see:

- Using algorithms for writing a program reduced the complexity and make it easy.
- Using algorithms have increased the flexibility and used in every programming language.
- Using algorithms is easy to understand.

**Flowchart**

The graphical representation of the solution of a problem is called a flowchart. It represents the flow of data in a sequence to explain and understand the problem easily. There are different types of symbols (Shapes) used to display the data. Every type of data has contained specific shapes.

### Advantages of Flowchart

There are some important advantages of flowchart let see:

- We can define algorithms using flowchart are more effective
Flowchart guide developers to understand the problem

- Through Flowchart easy to understand the problem
- Using Flowchart finding the error easily
- Through flowchart creating program less time consuming

## Flowchart Symbols

In the Flowchart different type of symbols used for different statement. Now, we discuss these symbols one by one:

### 1. Input/Output

Parallelogram symbol is used for input/output step. Input is used to get input from user and the output is used to display the output.

### 2. Process

Rectangular symbol represents the process step. In this step assign the statement for calculation.

### 3. Selection

Diamond symbol is used for Selection step. In this step give a condition i.e. if 20 > 34 or 23 < 14 in this two directions are available. One direction if condition is true and the second direction if the condition is false.

### 4. Start/End

Oval symbol is used for End or Start the flowchart.

### 5. Flow Lines

Arrow symbol is used for the flow of the flowchart. Four flow lines are used for it.

### 6. Connector

Circle symbol is used for connector. It can connect different flow lines with one another.

### Function Call

Rectangular symbol with double lines on left and right side used for function call. And the Parameter is written inside it.

### 8. Preparation

This symbol is used for display the start and stop condition for (for loop).

## 7 Comments

Great

ReplyDeleteVery helpful article

DeleteVery helpful article

ReplyDeleteVery helpful article

ReplyDeleteVery helpful article

ReplyDeleteGreat and helpful..

ReplyDeleteGreat and helpful..

ReplyDeletePlease do not enter any spam link in the comment box.