What is algorithm in programming and write it

Algorithm in programming can be defined as a sequence of activities to be processed for getting desired output from a given input.Or in other words it is a formula or set of steps for solving a particular problem. To be an algorithm, a set of rules must be unambiguous and have a clear stopping point.

Algorithm in programming can be defined as a sequence of activities to be processed for getting desired output from a given input.Or in other words it is a formula or set of steps for solving a particular problem. To be an algorithm, a set of rules must be unambiguous and have a clear stopping point. There may be more than one way to solve a problem, so there may be more than one algorithm for a problem.

Learn about programming chart or flow chart.

## Algorithm in programming

From the above Data we can say that:
1. Getting specified output is essential after algorithm is executed.
2. One will get output only if algorithm stops after finite time.
3. Activities in an algorithm to be clearly defined in other words for it to be unambiguous.

Before writing an algorithm for a problem, one should find out what is/are the inputs to the algorithm and what is/are expected output after running the algorithm. Now let us take some exercises to develop an algorithm for some simple problems: While writing algorithms we will use following symbol for different operations:

'-' for Subtraction
'*' for Multiplication
'/' for Division and
' ' for assignment.
For example A X*3 means A will have a value of X*3. Lets look at some problems on algorithm.

Problem 1: Write an algorithm to Find the area of a Circle of radius r.

Inputs to the algorithm:
Expected output:
Area of the Circle

Algorithm:
Step2: Area PI*r*r // calculation of area
Step3: Print Area

Problem 2: Write an algorithm to read two numbers and find their sum.
Inputs to the algorithm:
First num1.
Second num2.
Expected output:
Sum of the two numbers.

Algorithm:
Step1: Start
Step4: Sum num1+num2 // calculation of sum
Step5: Print Sum
Step6: End
 Write an algorithm easily

## Type of Algorithms

The algorithm and flowchart, classification to the three types of control
structures. They are:

1. Sequence
2. Branching (Selection)
3. Loop (Repetition)

These three control structures are sufficient for all purposes.

The sequence is exemplified by sequence of statements place one after the other – the one above or before another gets executed first.

The branch refers to a binary decision based on some condition. If the condition is true, one of the two branches is explored; if the condition is false, the other alternative is taken. This is usually represented by the "if-then" construct in pseudo-codes and programs. Lets see an example.

Problem 3: write algorithm to find the greater number between two numbers
Step1: Start
Step3: If A greater than B then C=A
Step4: if B greater than A then C=B
Step5: Print C
Step6: End
The loop allows a statement or a sequence of statements to be repeatedly executed based on some loop condition. It is represented by the 'while' and 'for' constructs in most programming languages, for unbounded loops and bounded loops respectively. Lets see an example.

Problem 4: An algorithm to calculate even numbers between 0 and 99
1. Start
2. I ← 0
3. Write I in standard output
4. I ← I+2
5. If (I <=98) then go to line 3
6. End

## Properties of algorithm

Here is a list of five properties for an algorithm, these properties are:
1) Finiteness: An algorithm must always terminate after a finite number of steps. It means after every step one reach closer to solution of the problem and after a finite number of steps algorithm reaches to an end point.
2) Definiteness: Each step of an algorithm must be precisely defined. It is done by well thought actions to be performed at each step of the algorithm. Also the actions are defined unambiguously for each activity in the algorithm.
3) Input: Any operation you perform need some beginning value/quantities associated with different activities in the operation. So the value/quantities are given to the algorithm before it begins.
4) Output: One always expects output/result (expected value/quantities) in terms of output from an algorithm. The result may be obtained at different stages of the algorithm. If some result is from the intermediate stage of the operation then it is known as intermediate result and result obtained at the end of algorithm is known as end result. The output is expected value/quantities always have a specified relation to the inputs
5) Effectiveness: Algorithms to be developed/written using basic operations. Actually operations should be basic, so that even they can in principle be done exactly and in a finite amount of time by a person, by using paper and pencil only.

Learn about Programming language in Demand

Name

ltr
item
MindxMaster: What is algorithm in programming and write it
What is algorithm in programming and write it
Algorithm in programming can be defined as a sequence of activities to be processed for getting desired output from a given input.Or in other words it is a formula or set of steps for solving a particular problem. To be an algorithm, a set of rules must be unambiguous and have a clear stopping point.
https://1.bp.blogspot.com/-0tkmcp6vEss/VrdnW2346aI/AAAAAAAABeI/lQorO_HH7Q0/s1600/Untitled.jpg
https://1.bp.blogspot.com/-0tkmcp6vEss/VrdnW2346aI/AAAAAAAABeI/lQorO_HH7Q0/s72-c/Untitled.jpg
MindxMaster
http://www.mindxmaster.com/2016/02/what-is-programming-algorithms-how-to.html
http://www.mindxmaster.com/
http://www.mindxmaster.com/
http://www.mindxmaster.com/2016/02/what-is-programming-algorithms-how-to.html
true
5332415103371288268
UTF-8