Computer Science, asked by bhadaneavinash77, 4 months ago

tell how to find factorial of a number using recursive approach in java​

Answers

Answered by muktakaurgmailcom
0

Answer:

n! = n×(n-1) !:

Example:-5!= 5×(5-1)! =5×4!

=5×24= 120 .

Explanation:

Hope it helps you...☺️☺️

Answered by samarthkrv
0

Answer:

import java.util.*;

class Main

{

static long fact(int n)

{

 if(n == 1)

 {

 return 1;

 }

return n * fact(n-1);

}

public static void main(String[] args)

{

Scanner sc = new Scanner(System.in);

int n = sc.nextInt();

System.out.println(fact(n));

}

}

Explanation:

Similar questions