展开全部
直接贴e68a843231313335323631343130323136353331333365653136代码:public class Main {
public static void main(String[] args) throws IllegalAccessException {
System.out.println(factorial(3));
}
public static String factorial(long num) throws IllegalAccessException {
if (num
throw new IllegalAccessException("输入参数非法");
}
StringBuilder builder = new StringBuilder();
builder.append(num).append("!=");
long temp = 1;
for (long i = 1; i <= num; i++) {
temp *= i;
builder.append(i).append("x");
}
builder.deleteCharAt(builder.length() - 1);
builder.append("=").append(temp);
return builder.toString();
}
}