Menu
Question Index
...

What will be the output of the following program?

class Factorial
{
    public static void main(String s[])
    {
        int number = 5;

        int factorial = 1;

        for(int i = 2; i <= number; i++ )
        {
            factorial *= number;
        }

        System.out.println("Factorial of 5 is " + factorial);
    }
}


Factorial of 5 is 1
Factorial of 5 is 120
Compilation Errors
Factorial of 5 is 625

Doubts

Problems

Topic: for Loop In Java

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App