본문 바로가기

코딩테스트(백준)

[백준] 10872번: 팩토리얼 -JAVA - 사좋배 공유

 

 

답 : 

 

 

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		
		Scanner sc= new Scanner(System.in);
		int number;
		int temp=1;
		number=sc.nextInt();
		
		for(int i=number;i>0;i--) {
			temp=temp*i;
			
		}
		System.out.println(temp);
	}

}