[프로그래머스 | Lv.0] 두 수의 곱

이승민·2023년 8월 2일
0

프로그래머스

목록 보기
17/27

https://school.programmers.co.kr/learn/courses/30/lessons/120851

📝 나의 풀이

using System;

public class Solution {
    public int solution(string my_string) {
        int answer = 0;
        
        char[] my_char = my_string.ToCharArray();
        
        for(int i=0; i<my_char.Length; i++){
        
            //10진수인지 판별
            if(Char.IsDigit(my_char[i])){
                answer += (int)my_char[i]-48;
            }
        }
        return answer;
    }
}

0개의 댓글

관련 채용 정보