Skip to content

Commit 19a1a1a

Browse files
authored
Create factorial.java
Program to create factorial of a number
1 parent 61d3432 commit 19a1a1a

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

factorial.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
public class factorial{
2+
3+
public static void main(String args[])
4+
{
5+
Scanner s=new Scanner(System.in);
6+
int n=s.nextInt();
7+
long f=1;
8+
9+
for(int i=1;i<=n;i++)
10+
f=f*i;
11+
System.out.println(f);
12+
13+
}
14+
15+
}

0 commit comments

Comments
 (0)