10872번
문제
- 정수 N의 팩토리얼을 출력하는 문제
문제 해결 순서
- 반복문을 돌면서 N번째까지 곱해준다.
import java.util.Scanner;
class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
int answer = 1;
for(int i = 1; i <= n; i++){
answer *= i;
}
System.out.print(answer);
}
}