Competitive Programming Solutions

GitHub
back to dashboard

G. Factorial

Codeforces - Sheet #2 (Loops) · limit: 2s · memory: 64MB · view on codeforces

input

2
5
3

output

120
6
Main.java
static void solve() {

        // Write your solution here
        long result = 1;
        for (int i = in.nextInt(); i > 0; i--) {
            result = result * i;
        }
        out.println(result);
    }