코딩테스트/프로그래머스 - LV 0
[프로그래머스] 문자열 정수의 합
웅드
2024. 1. 25. 18:08
- 풀이
#include <string>
#include <vector>
using namespace std;
int solution(string num_str) {
int answer=0;
for(int i=0; i< num_str.size(); i++){
answer += num_str[i]-'0';
}
return answer;
}
반응형