Skip to content

Commit d8e326d

Browse files
Factorial Number
Factorial Number Co-Authored-By: Manish Upadhyay <ermanishupadhyay@gmail.com>
1 parent cb2c0e2 commit d8e326d

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/JavaPrograms/FactorialNumber.java

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package JavaPrograms;
2+
3+
public class FactorialNumber {
4+
5+
public static void main(String[] args) {
6+
//!5 = 5*4*3*2*1 = 120
7+
8+
int num = 5;
9+
int fact = 1;
10+
11+
for(int i=1; i<= num; i++) {
12+
fact = fact*i;
13+
}
14+
15+
System.out.println("Factorial of " + num + " is : " + fact);
16+
17+
}
18+
19+
}

0 commit comments

Comments
 (0)