#include <stdio.h>
void main()
{
int fac( int n);
int i;
for ( i = 1; i <= 5; i++)
printf ("%d!=%d\n", i, fac(i));
}
int fac(int n)
{
static int f = 1;
f = f * n;
return(f);
}
输出1 到 5 的阶乘值
最新推荐文章于 2023-12-05 08:41:14 发布
#include <stdio.h>
void main()
{
int fac( int n);
int i;
for ( i = 1; i <= 5; i++)
printf ("%d!=%d\n", i, fac(i));
}
int fac(int n)
{
static int f = 1;
f = f * n;
return(f);
}