MCPcopy Create free account
hub / github.com/Manvityagi/PW-Skills-Java-Course-Codes / Factorial

Class Factorial

Lecture 08_Loops_1/src/Factorial.java:3–15  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1import java.util.Scanner;
2
3public class Factorial {
4 public static void main(String[] args) {
5 Scanner sc = new Scanner(System.in);
6 int n = sc.nextInt();
7
8 int fact = 1;
9
10 for(int i = 1; i <= n; i++){
11 fact = fact * i;
12 System.out.println("Factorial of " + i + ": " + fact);
13 }
14 }
15}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected