# include <stdio.h> int main(void) { int val; printf("请输入一个数字:"); printf("val = "); scanf("%d", &val); for (i=1; i<=val; ++i) { mult = mult * i; } printf("%d的阶乘是:%d ", val, mult); return 0; }
# include <stdio.h> int main(void) { int val; printf("请输入一个数字:"); printf("val = "); scanf("%d", &val); for (i=1; i<=val; ++i) { mult = mult * i; } printf("%d的阶乘是:%d ", val, mult); return 0; }