Computer Science, asked by Tushar3360, 9 months ago

how to find factorial of 3,5,7 9.....t9 math term in one program in java​

Answers

Answered by komal10381
0

Answer:

Here is the list of different types of factorial java code along with sample outputs. If you have no idea on how to solve the Factorial in math, do check out our tutorial below so that you will get an idea. The Factorial program in Java, we have written the following program in five different ways, using standard values, using while loop, using for loop, using do while loop, using method or function, using recursion.

If you have any doubts related to the code that we shared below do leave a comment here at the end of the post our team will help you out related to ant query

Explanation:

Q > How to calculate?

For example :

Consider :

2! = 2 x 1 = 2

The possibility of 2! is two ways like {2,1}, { 1,2 }.

Same as like :

4! = 4 x 3 x 2 x 1 = 24.

24 = the arrangement of 4! is {1,2,3,4}, {2,1,3,4}, {2,3,1,4}, {2,3,4,1}, {1,3,2,4}, etc.

Same as like 5! , 10! , N!.

Attachments:
Answered by za6715
2

Answer:

Consider :

2! = 2 x 1 = 2

The possibility of 2! is two ways like {2,1}, { 1,2 }.

Same as like :

4! = 4 x 3 x 2 x 1 = 24.

24 = the arrangement of 4! is {1,2,3,4}, {2,1,3,4}, {2,3,1,4}, {2,3,4,1}, {1,3,2,4}, etc.

Same as like 5! , 10! , N!.

public static void main(String arg[])

{

int n=5,fact=1;

for(int i=1;i<=n;i++)

{

fact=fact*i;

}

System.out.println("factoral="+fact);

}

Similar questions