What is recursive ?

Hello everyone,

We write algorithm sometimes. We should use recursive functions when performing mathematical operations. One of them is factorial calculation.

Recursive function calculation application that I made in its simplest form:

using System;namespace FactorialConsoleApp{public class Program{static void Main(string[] args){Program p = new Program();int factorial = p.CalculateFactorial(4);Console.WriteLine(“factorial:” + factorial);Console.ReadLine();}public int CalculateFactorial(int number){if (number == 1)return number;elsereturn number * CalculateFactorial(number -1);}}}

Reducing by one the number we want to calculate whenever the number is one we multiply the numbers and return number.

--

--

--

Computer Engineer, Software Developer

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Corporate O365 but wants/needs Linux? I got your back!

The Railsification of SaaS

Books on Learning DITA

Introducing: Midnight Commander (with added Enter key functionality!)

From the problem to the MVP: how ChartBear was born

Product Management

Words With Friends 2 & How We Built Lightning Round

AWS IoT Project

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Taşkın Binbir

Taşkın Binbir

Computer Engineer, Software Developer

More from Medium

Factory Design Pattern with Dependency Injection (Notepad Series #4)

State Management in ASP.NET

Microsoft .NET challenge France 2020 final

Easy Modular Monolith — Part 6 — Synchronous communication between modules