In this article Algorithm in c language we give the information about Algorithm it is a Procedure or it is a Formula. This solves a problem. This is a procedure in which there are limited rules, which are also called instructions.
Algorithm in c language:
Define Algorithm in C Programming:-
In order for the computer to do some work, computer programs are written. Now in Computer Program we write many steps. The steps that the computer executes and finishes the work.
When you tell the computer some work, then you must also be thinking that how the computer does these tasks. For this we use Computer Algorithm.
Definition of algorithm:
“An algorithm is finite set of rules for solving a specific type of problems.”
Algorithm It is a Procedure (Step by Step Process) or it is a Formula. This solves a problem. This is a procedure in which there are limited rules, which are also called instructions.
Uses/Importance of Algorithm:-
- The use of Algorithm is everywhere, as you can also find answers to your everyday problems through this Step by Step Process. Technically, if we said, it is used more in IT Industry, Business Model, Programming. So let’s know about its uses one by one.
- Algorithm is written before writing the program in Computer Programming. If you are a student of Computer Sc, IT, BCA and MCA then you have to write a program. Like Check Whether the Number is Prime and Not ? If you start writing this program without thinking, then you can probably see many errors in the program. You can reduce these errors if you make the algorithm first.
Characteristics of Algorithm:-
- Unambiguous –Whatever algorithm you write, it is very important to be clear and precise. Every step or line should have some meaning.
- Finiteness-Every Algorithm should be finished within few limited steps. And every step should be Finite i.e. Repeat limited times. Execution of steps should also be for limited time. Every step should have some meaning.
- Input –Every algorithm should have more precise steps by steps.
- Output –Just like every algorithm has an Input Step, similarly the Algorithm should also have an Output Step. The output should also come the same for which we have written.
- Effectiveness-Effectiveness is estimated from Time and Space. If the algorithm is written in less time and space. Or it is executed in less time and runs in less space, this is called Effectiveness.
Advantages of Algorithm:
- The use of algorithms to express the solution of a complex problem in many different steps in a simple way, which makes it easy to understand.
- All algorithms follow a certain procedure and reduce a big problem to be expressed in simple words.
- It does not depend on any programming language, so it is easy to understand even for a person without knowledge of programming.
- An algorithm follows a logical sequence at every step, so it is very easy to debug it i.e. find faults in it and fix it.
- By using algorithm, the problem is broken down into small pieces or steps so it is easy to understand.
Disadvantages of Algorithm:
- The process of making an algorithms wastes a lot of time because it is not a computer program, but a concept of what the program should be like.
- Many things it becomes difficult to express a particular part of the problem according to the syntax of the algorithm i.e. grammar or grammar.
Q1. Write an algorithm to display addition of two numbers.
Step 1: Start
2: Declare variables num1, num2 and sum.
3: Read values num1 and num2.
4: Add num1 and num2 and assign the result to sum.
5: Display sum