프로그래머스/Lv.0

[프로그래머스 C#] 제곱수 판별하기

suniverse 2023. 9. 3. 15:20

 

using System;

public class Solution {
    public int solution(int n) {
        int answer = 0;
        
        answer = Math.Sqrt(n) % 1 == 0 ? 1 : 2;
        
        return answer;
    }
}