added scanner in factorail program
This commit is contained in:
parent
3b245025d3
commit
1c062e2c7a
@ -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));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user