Skip to content

Commit 1c062e2

Browse files
added scanner in factorail program
1 parent 3b24502 commit 1c062e2

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Maths/Factorial.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
package Maths;
2+
import java.util.*; //for importing scanner
23

3-
//change around 'n' for different factorial results
44
public class Factorial {
55
public static void main(String[] args) {
6-
int n = 5;
6+
int n = 1;
7+
Scanner sc= new Scanner(System.in);
8+
System.out.println("Enter Number");
9+
n=sc.nextInt();
710
System.out.println(n + "! = " + factorial(n));
811
}
912

0 commit comments

Comments
 (0)