인프런 영문 브랜드 로고
인프런 영문 브랜드 로고

Inflearn Community Q&A

Mizue Lee's profile image
Mizue Lee

asked

[MMORPG Game Development Series with C# and Unity] Part 1: Introduction to Basic C# Programming

Practice Problems

팩토리얼 별거 아니지만 질문...

Written on

·

262

0

이렇게 해도 딱히 상관은 없겠지요?

static int Factorial(int n)
{
        if (n == 1) return n;
        return n * Factorial(n - 1);
}
C#

Answer 1

1

rookiss님의 프로필 이미지
rookiss
Instructor

팩토리얼 정의상, 0! = 1입니다
0을 입력하면 크래시가 나는게 옥의 티네요.

Mizue Lee님의 프로필 이미지
Mizue Lee
Questioner

0을 입력받는건 생각을 못했었네요. 감사합니다!

Mizue Lee's profile image
Mizue Lee

asked

Ask a question