Output:
Click Here For Java Online Compiler
Solution:
*** Factorial Using While lOOp Only *** Factorial of 5 is: 120
Click Here For Java Online Compiler
Solution:
class FactorialUsingWhileLoop { public static void main(String[] args) { int factorialOf = 5; long fact = 1; int i = 1; while (i <= factorialOf) { fact = fact * i; i++; } System.out.println("*** Factorial Using While lOOp Only ***" + "\n"); System.out.println("Factorial of " + factorialOf + " is: " + fact); } }
comment 0 comments:
more_vertsentiment_satisfied Emoticon