면접 후기

이진섭·2023년 3월 31일
0

면접

목록 보기
1/1
  1. 변수 치환
  2. 임시변수 없이 변수 치환
  • a = a + b; // a : 6 | b : 4
    b = a - b; // a : 6 | b : 2
    a = a - b; // a : 4 | b : 2
  1. 재귀함수 팩토리얼
public class Test {
 
    public static void main(String[] args) {
        // TODO Auto-generated method stub
        
        int result = factorial(10);
        System.out.println(result);
    }
    
    public static int factorial (int num) {
        if (num == 1)
            return 1;
        
        return num * factorial ( num - 1 );
    }
}
profile
하루하루성장하기

0개의 댓글