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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy