mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-10 21:43:15 +08:00
added scanner in factorail program
This commit is contained in:
@ -1,9 +1,12 @@
|
|||||||
package Maths;
|
package Maths;
|
||||||
|
import java.util.*; //for importing scanner
|
||||||
|
|
||||||
//change around 'n' for different factorial results
|
|
||||||
public class Factorial {
|
public class Factorial {
|
||||||
public static void main(String[] args) {
|
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));
|
System.out.println(n + "! = " + factorial(n));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user