mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-09 12:11:28 +08:00
added scanner in factorail program
This commit is contained in:
@ -1,9 +1,12 @@
|
||||
package Maths;
|
||||
import java.util.*; //for importing scanner
|
||||
|
||||
//change around 'n' for different factorial results
|
||||
public class Factorial {
|
||||
public static void main(String[] args) {
|
||||
int n = 5;
|
||||
int n = 1;
|
||||
Scanner sc= new Scanner(System.in);
|
||||
System.out.println("Enter Number");
|
||||
n=sc.nextInt();
|
||||
System.out.println(n + "! = " + factorial(n));
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user