09/05/10 12:20:11
VC2008 XP
#include <stdio.h>
int factn(int n);
int main()
{
int n,fact;
for (n = 0; n <= 10; n++)
{
fact = factn(n);
printf("d%! = %d\n",n,fact);
}
while ( true )
{
;
}
}
int factn(int n)
{
int i,fact;
fact = 1;
for (i = 1; i <= n; i++)
{
fact = fact * i;
}
return fact;
}
関数を使って0~10までの階乗がしたいんですが
表示がd!=1 d!=2…ってなってしまいます。
どこがおかしいんでしょうか?