0

How is the (fact ) variable showing printing the addition of all list ?

public class Example3 { public static void main(String[] args) { int n=6; int fact=1; while(n>=1) { System.out.println(n+""); fact= fact*n; n--; //n = n-1; //n -= 1; } System.out.println("result="+fact); // Here is my question :)

27th Oct 2022, 6:48 PM
Rakan Ezzedin
1 ответ
+ 1
Look at the result of this code: public class Example3 { public static void main(String[] args) { int n=6; int fact=1; while(n>=1) { System.out.println(fact+" * "+n); fact = fact * n; n--; } System.out.println("\nResult = "+fact); } }
27th Oct 2022, 7:14 PM
Solo
Solo - avatar