**Examples of Algorithms in Everyday Life** – For those of you who are learning basic programming, you must be introduced to the algorithm first. Usually you will be introduced to simple algorithms first and then progress to algorithms that require thinking hard.

Because algorithms are very important in compiling the logic or flow of a programming, a prospective programmer must be able to compile algorithms before knowing a programming language.

**What is an algorithm?**

What do you think is the first thing that comes to your mind when you hear the word algorithm? Almost everyone must be concerned about the complex mathematical calculations used in programming.

This is not wrong, almost all programming will require logarithms as a basis. Without an algorithm, we will not get maximum programming results. But even though algorithms are synonymous with mathematical calculations, in fact not all programming is related to mathematics.

Like a cooking recipe, the algorithm will explain the flow of each step in great detail until the recipe becomes ready-to-eat food. A chef can’t just write “add meat”.

Recipes that lack detail can raise a lot of questions. Beef or mutton, how much, which part of the meat, and other questions.

So that’s the analogy of an algorithm, which is step by step made logically to process input in the form of food ingredients into output in the form of food that is ready to be enjoyed.

The difference is, algorithms solve problems with mathematical calculations, reasoning or logic, and data processing. And the algorithm can also be displayed in the form of a flowchart. With an algorithm, anyone can read the program more easily.

**Algorithm features**

Each person is free in designing a programming algorithm. But what is clear is that the algorithm has five interrelated characteristics, among others

### 1. Inputs

Input means data that is required and must exist at the beginning of solving the problem. For example, in solving the area of a circle, we need data on the radius or diameter of the circle. 2. Outputs

Output is the final result of the algorithm. For example, the algorithm determines student graduation, so the resulting output is information on whether the student passed or failed.

### 3. Process

The process is the steps and plans that must be undertaken to achieve programming goals. To cook rice, we have to start by taking the rice, cleaning it, and heating it in the rice cooker. Then wait until the final goal is reached, which is to get cooked rice.

### 4. Unambiguous

Instructions that are not clear can produce output that is not fit for purpose. Therefore, a programmer must be able to make an algorithm that is clear and does not cause double or ambiguous meanings.

For example cutting and putting in a blender. Then the order must be clear that what is cut is a mango and then blended to make juice.

### 5. Final goal

An algorithm must have a final destination or stopping point. After the program is able to display the results of calculating the area of a circle, the program must stop,

Algorithms are synonymous with ways of thinking in solving problems. That’s why it’s not surprising that every programmer sometimes has different algorithm ideas, even though the source of the problem is the same.

To determine which algorithm to choose, the main consideration is which is the most efficient for solving the problem. Because efficient algorithms will minimize computer memory usage and require less time.

**The use of algorithms in programming**

Previously, we discussed what a feature algorithm is, and its importance in computer programming. Now, this time we will share some of the benefits and uses of the algorithm.

### 1. It’s easier to understand the program

Programs that involve high-level mathematical calculations are sometimes prone to errors, both logic errors and program code. Surely it will be very difficult for us to check the program code one by one. Different if we have a good algorithm.

The existence of an algorithm helps to simplify and make it easier to understand a program, making it easier to track errors and then fix them.

### 2. More efficient

Algorithms are able to help solve problems sequentially and systematically. If you want to add new functions, you don’t need to create an algorithm from scratch or rewrite the program. But it remains only to put the new functions in the right order

### 3. Form a mindset

For students or programmers, the habit of making automatic algorithms will improve their thinking skills. The core of the algorithm is the logic and sequence of problem solving, so that a programmer is required to be able to build solutions systematically.

**Flow chart **

In the earlier part, it was explained that the algorithm is explained with a flowchart or flowchart. So a flowchart is an algorithm in the form of symbols, shapes, and arrows that show the process of a program.

The main purpose of flowcharts is to facilitate writing programs and to analyze various processes. Below are some examples of standard symbols commonly used in flowcharts.

**Different algorithms and flowcharts**

There are clear differences between algorithms and flowcharts, but in fact there are still many who consider both to be the same. To avoid misunderstanding, we will also discuss the difference between an algorithm and a flowchart.

In programming, the algorithm is the first step that the programmer takes. They have to write down the steps and plans that must be carried out to solve the problem through computer programming.

Algorithm examples are not only used in programming problems. But it can also be applied in everyday life and in making company operational standards. For example the order for cooking fried noodles, cleaning the floor, procedures for serving customers, and much more.

While the flowchart or flowchart is a step to solve the problem in the form of symbols and data flow. If we enter an office such as a hospital, bank, or community service office, there is usually a flowchart that explains service procedures.

The flowchart aims to make the whole process easier for everyone to understand. Therefore, the flowchart must be displayed clearly and concisely.

So in short, an algorithm is a series of problem solving displayed in everyday language, while a flowchart is in image format.

## Examples of algorithms and flowcharts

So to make it clearer, let’s just take a look at some examples of algorithms and flowcharts below.

### 1. Algorithm Example Calculating the perimeter of a rectangle

The formula for the perimeter of a rectangle K= 2 x (p+l)

Input= p (length) and l (width)

Output= K (circumference)

Algorithm Example:

- Enter the length (p) and width (l) values
- To calculate the perimeter of a rectangle, use the formula K= 2 x (p+l)
- The output will produce a value of K (circumference of the rectangle)

Flow chart:

### 2. Example of Algorithm Calculating the area of a circle

The formula for the area of a circle L = Phi xr^{2}

Input= Phi and r (radius)

Output= L (circle area)

Algorithm Example:

- Determine the value of phi = 3.14
- Enter the radius of the circle
- To calculate the area of a circle, use the formula L= Phi xr
^{2} - The output will produce a value of L (circle area)

Flow chart:

### 3. Example of Algorithm Calculating the area of a triangle

The formula for the area of a triangle L = axt/2

Input= a (base) and t (height)

Output= L (area of triangle)

Algorithm Example:

- Enter the base value a (base) and t (height)
- To calculate the area of a circle, use the formula L= axt/2
^{2} - The output will produce a value of L (area of the triangle)

Flow chart:

### 4. Example of Algorithm Calculating employee salaries

The formula for net salary = base salary + benefits – taxes

Input = base salary

Output = net salary

Algorithm Example:

- Determine equal benefits for all employees = Rp. 1,000,000
- Enter base salary
- Tax 5% of base salary + allowances
- To calculate net salary, use the formula net salary = base salary + benefits – taxes
- Output will result in net salary

Flow chart:

### 5. Examples of Celsius to Fahrenheit and Reamur temperature conversion algorithms

R = 4/5 x C and F = (9/5 x C) + 32

Input= temperature in Celsius

Output= temperature in Fahrenheit and Reamur units

Algorithm Example:

- Enter the temperature in Celsius (C)
- To convert temperature from Celsius to Fahrenheit, use the formula F = (9/5 x C) + 32
- To convert temperature from Celsius to Reamur, use the formula R = 4/5 x C
- The output will display the temperature in Fahrenheit and Reamur

Flow chart:

Algorithms and flowcharts are not only used in solving math problems, but can also be applied to everyday problems. Here are some examples

### 6. An example of an algorithm for making fried rice

Algorithm Example:

- Prepare a stove, frying pan, rice, cooking oil, and other seasonings
- Turn on the stove and add a little cooking oil
- Enter the seasoning until it feels good
- Add enough rice and stir
- Add soy sauce, sauce, chili sauce and vegetables
- Taste the fried rice
- If it tastes right, it’s ready to serve

Flow chart:

### 7. Make coffee

Algorithm Example:

- Prepare coffee, sugar, hot water, spoons and glasses
- Put coffee, sugar and water in a glass
- Stir the coffee-water mixture with a glass
- Try the coffee water
- If it tastes good, it’s ready to serve

Flow chart:

### 8. Make mango juice

Algorithm Example:

- Prepare mangoes, sugar, water, glass and blender
- Peeling mangoes
- Put mangoes, sugar and water in a blender
- Press the on button and blend until smooth
- Tried the taste
- If it tastes good, put it in a glass and it’s ready to be enjoyed

Flow chart:

### 9. Cook rice

Algorithm Example:

- Prepare rice, container, water, and rice cooker
- Put the rice in the container
- Wash rice with water until clean
- Put the container containing the rice into the rice cooker
- Connect the rice cooker cable to the wall socket
- Press the on button on the rice cooker (power button down)
- Wait until the rice is cooked which is indicated by the power button going up
- If the light is green, the rice is cooked and ready to serve

Flow chart:

### 10. Student graduation

Input = student name and grade

Output = student name, grade, and pass/fail statement

Algorithm Example:

- Enter the student’s name and grade
- Students will “pass” with the condition that the score is> 70
- Students “fail” if the value is <70
- The output will show name, grade, and passed/failed

Flow chart:

So, that was an explanation of what an algorithm is, its benefits, and some examples of its use. Hopefully some of the examples of algorithms and flowcharts above are useful for anyone who is starting to learn programming. Happy training and always success!

Conclusion

Reviewer

Technorus Media

Date

Title

Algorithm Example

Ratings

Product Name

Algorithm Example

Price

USD 0

Product Availability

Available in Store Only