//Factorial of a number using Recursion method
import java.util.Scanner;
public class Factorial {
static int fact(int n) {
if (n == 1)
return 1;
else
return (n * fact(n - 1));
}
public static void main(String args[]){
Scanner sc = new Scanner(System.in);
System.out.println("Enter the Number: ");
int num;
num = sc.nextInt();
int factorial = fact(num);
System.out.println("Factrorial of entered number is: "+factorial);
}
}
- Algorithms
- _Searching Algorithms
- __Linear Search Algorithm
- __Binary Search Algorithm
- ___Binary Search: Recursive Implementation
- ___Binary Search: Iterative Implementation
- _Sorting Algorithms
- __Bubble Sort Algorithm
- ___Bubble Sort: Basic Approach
- ___Bubble Sort: Modified Approach
- ___Bubble Sort: Optimised Approach
- __Insertion Sort Algorithm
- _Selection Sort Algorithm
- _Kadane's Algorithm
- _Dutch National Flag Algorithm
- Topics
- _Binary Tree
- _Binary Search Tree
- _Recursion
- _String
- Android Tutorials
- HTML/CSS Tutorials
- Important Questions