Skip to content

Commit 91df9a0

Browse files
author
codehouseindia
authored
Merge pull request codehouseindia#159 from shawabhishek/master
Create fact.java
2 parents 9d3200f + e33ec36 commit 91df9a0

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

fact.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
public class Factorial {
2+
3+
public static void main(String[] args) {
4+
5+
int num = 10;
6+
long factorial = 1;
7+
for(int i = 1; i <= num; ++i)
8+
{
9+
// factorial = factorial * i;
10+
factorial *= i;
11+
}
12+
System.out.printf("Factorial of %d = %d", num, factorial);
13+
}
14+
}

0 commit comments

Comments
 (0)