The call to user()
does not store the result locally. Change
//int p = user();
//System.out.println(p);
user()
for (i = 0; i <= n; i++) {
to
int n = user(); // <-- you want `n`, not `p`.
for (i = 1; i <= n; i++) { // <-- 0 * x == 0, do not start with i = 0
Further, in main
you aren't printing the result.
fecto fe = new fecto();
int result = fe.facto1();
System.out.println(result);
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…