factorial1 C# (팩토리얼 재귀함수) using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace RoadBook.CsharpBasic.Chapter01.f0513 { class Factorial2 { public void Run() { Console.WriteLine(Factorial(5)); } static int Factorial(int n) { if(n==0 || n == 1) { return 1; } return n * Factorial(n-1); //재귀함수 } } } 2021. 5. 13. 이전 1 다음