A finite set of rules to be followed in a calculation or to obtain a result in a finite number of steps.

If the number of steps is theoretically infinite, then the process is called an iteration.

An algorithm is a method used to solve a class of problems that differ only in the value of the data introduced in the various steps.

An algorithm is a method used to solve a class of problems that differ only in the value of the data introduced in the various steps.

Computer programs are basically algorithms that are coded in a language that the device can interpret and execute.

### Example

The method used to divide two decimals is an example of a simple algorithm.

### Historical note

The term “algorithm” is derived from the Latinized name of Persian mathematician Al‑Khwarizmi (780-850).