remove redundant code

This commit is contained in:
SowinskiBraeden committed 2025-02-16 15:52:36 -08:00
1 parent 8b942b5ddf
commit 83e5d02f4f
1 file changed
+7 -11
+7 -11
View File
@@ -46,17 +46,13 @@ public class Factorial {
int number = readPositiveInt(); int number = readPositiveInt();
if (number == 0) { int product = 1;
System.out.println("The factorial of 0 is 1."); for (int i = 2; i <= number; i++) {
} else { product *= i;
int product = 1;
for (int i = 2; i <= number; i++) {
product *= i;
}
System.out.println("The factorial of "
+ number + " is "
+ product + "."
);
} }
System.out.println("The factorial of "
+ number + " is "
+ product + "."
);
} }
} }