次数10
#include #include #define N 10 int M[N+1][N+1];//M 宣言済み global unsigned long fact_recursive (unsigned short nombre) { if (number == 0) return 1スパン>; else 戻り値 number * fact_recursive(number - 1); } int triangle(int b) { int型i、k = 1、j; for(i=0スパン>;私は { for(j=0スパン>;j<=i;j++) { k=fact_recursive(i)/(fact_recursive(j)*fact_recursive(i-j)); printf("%4d\t",k); //M M[i][j]=k; } printf("\n"); } } int main() { 三角形(N); return 0スパン>; } |
Execution:
参照:
C++ 階乗の計算
tazzaz.com - C
Commentaires (12)
Connectez-vous pour commenter
Rejoignez la discussion et partagez vos connaissances avec la communauté
Excellent tutoriel !
N'hésitez pas si vous avez des questions.