Computer Science, asked by bina4000, 1 year ago

Write a program to find factorial of a number using recursive function

Answers

Answered by Varun1870
3
import java.util.Scanner;
public class Factorial
{
public static void main(String[] args)
{
int n, mul;
Scanner s = new Scanner(System.in);
System.out.print("Enter any integer:");
n = s.nextInt();
Factorial obj = new Factorial();
mul = obj.fact(n);
System.out.println("Factorial of "+n+" :"+mul);
}
int fact(int x)
{
if(x > 1)
{
return(x * fact(x - 1));
}
return 1;
}
}
Answered by advocatesanjeevsharm
1

Answer:

this

Explanation:

vgvxdbbsvgjhdmhk

Similar questions