Post

나머지가 1이 되는 수 찾기

1
2
3
4
5
6
7
8
9
10
11
12
public class solution {
        public int solution(int n) {
            int answer=0;
            for(int x=2; x<n; x++){
                if(n % x == 1) {
                    answer = x;
                    break
                }
            }
            return answer;
        }
}
This post is licensed under CC BY 4.0 by the author.