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 :)
1 Antwoord
+ 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);
      }
}



