Skip to content
Snippets Groups Projects
Commit 21e1536a authored by iliya.saroukha's avatar iliya.saroukha
Browse files

factorial

parent 94717929
No related branches found
No related tags found
No related merge requests found
public class Factorial {
public static int factorial(int n) {
int res = 1;
for (int i = 1; i <= n; i++) {
res *= i;
}
return res;
}
public static void main(String args[]) {
System.out.println(factorial(3));
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment