这是我的析因程序代码。它工作正常,但是我不明白为什么为什么没有56,89,77和其他一些数字给我阶乘0。
private static void factorial() {
int resultant = 1, i;
System.out.println("Please Enter any number to find factorial : ");
Scanner scan = new Scanner(System.in);
int fact = scan.nextInt();
for (i = 1; i <= fact; i++) {
resultant = resultant * i;
}
System.out.println("Factorial of number : " + resultant);
}
侃侃无极
泛舟湖上清波郎朗
相关分类