프로그래머스/Lv.1

[프로그래머스 C#] 문자열 다루기 기본

suniverse 2023. 8. 21. 16:08

 

💻 풀이

public class Solution {
    public bool solution(string s) {
        bool answer = false;
        
        int num = 0;
        
        if(s.Length == 4 || s.Length == 6)
        {
            answer = int.TryParse(s, out num);
        }
        
        return answer;
    }
}