Skip to content

Commit 07eba37

Browse files
authored
Merge pull request mayankgb2#1 from rcode11/patch-2
Create factorial.java
2 parents 68c9cd1 + 0cca199 commit 07eba37

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

factorial.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
class FactorialExample{
2+
public static void main(String args[]){
3+
int i,fact=1;
4+
int number=5;//It is the number to calculate factorial
5+
for(i=1;i<=number;i++){
6+
fact=fact*i;
7+
}
8+
System.out.println("Factorial of "+number+" is: "+fact);
9+
}
10+
}

0 commit comments

Comments
 (0)