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

TryHackMe CTF Bounty Hacker: Walkthrough

Epics vs. User Stories: What’s The Difference? 🔖

Dart Programming — Tips and Tricks

smazee dart tutorial

The history of CMS — what has happened?

Arkward Silence in Remote Meetings? Not any more!

Developing an Interactive Dashboard for Value Investment with Python, Dash and Pandas (Version 1)

FPGA Applications vendor, join the dynamic licensing revolution!

Step-by-step: Kotlin and Docker

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

How to write a unit test for your custom attribute which extends ActionFilterAttribute in c# .net

Converting between types in increasingly absurd ways

Perform CSV to XML Conversion in C#

2.4 Type Conversion