We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2fe5975 commit d1f6136Copy full SHA for d1f6136
1 file changed
Basic Codes/factorial-by-loops.java
@@ -0,0 +1,21 @@
1
+package com.company;
2
+
3
+import java.util.Scanner;
4
5
+public class Factorial {
6
+ public Factorial() {
7
+ }
8
9
+ public static void main(String[] args) {
10
+ Scanner in = new Scanner(System.in);
11
+ System.out.println("you want factorial of which number");
12
+ int n = in.nextInt();
13
+ int fact = 1;
14
15
+ for(int i = n; 1 <= i; --i) {
16
+ fact *= i;
17
18
19
+ System.out.println("the factorial of " + n + " is " + fact);
20
21
+}
0 commit comments