Menu
Question Index
...


Write a program to find the factorial of a given number. If the input number is negative or zero, then return -1.

class Factorial

{    public static void main(String s[])
    {
        System.out.println("Factorial of 5 is " + factorial(5));

    }


public static int factorial(int number)
{
int result = 1;
//Write code here to find the factorial of given number and assign it to result
return result;
}
}

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