728x90
https://school.programmers.co.kr/learn/courses/30/lessons/181849
📝 나의 풀이
using System;
public class Solution {
public int solution(string num_str) {
int answer = 0;
char[] number = num_str.ToCharArray();
for(int i=0; i<num_str.Length; i++){
answer += (int)Char.GetNumericValue(number[i]);
}
return answer;
}
}
728x90
'코딩테스트 > [C#] 프로그래머스' 카테고리의 다른 글
[프로그래머스 | C# | Lv.1] 하샤드 수 (0) | 2023.10.13 |
---|---|
[프로그래머스 | C# | Lv.0] 공배수 (0) | 2023.10.12 |
[프로그래머스 | C# | Lv.1] 약수의 합 (1) | 2023.10.10 |
[프로그래머스 | C# | Lv.0] 특수문자 출력하기 (0) | 2023.10.09 |
[프로그래머스 | C# | Lv.0] 외계행성의 나이 (0) | 2023.10.05 |