Menu
Question Index
...


Rearrange the following such that the program prints the factorial of an input number. In this case the input is 5. Unselect any unwanted statements using the check box.

  • move             i = factorial * i;
            }
  • move         for(int i = 0; i < input; i++)
            {
  • move         for(int i = 1; i < input; i++)
            {
  • move class Factorial
    {
        public static void main(String s[])
        {
            int input = 5;
            int factorial = 1;
  • move         for(int i = 1; i <=input; i++)
            {
  • move             factorial = factorial * i;
            }
  • move         System.out.println("Factorial of 5 is " + factorial);
        }
    }

Doubts

Problems

Topic: Factorial Program In Java Using for Loop

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App