Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package tasks3;
- public class Factorial {
- public static int calculateFactorial(int n) {
- int result = 1;
- for (int i = 1; i <= n; i++) {
- result = result * i;
- }
- return result;
- }
- public static void main(String[] args) {
- System.out.println(calculateFactorial(5));
- }
- }
Add Comment
Please, Sign In to add comment