[프로그래머스 | C# | Lv.0] 이어 붙인 수

728x90

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

 

📝 나의 풀이

using System;

public class Solution {
    public int solution(int[] num_list) {

        int a =0;
        int b =0;
        
        foreach ( int i in num_list){
            if(i%2==0) {
              a = (a*10)+i;
            } else {
              b = (b*10)+i;
            }
        }
        
        return a+b;
    }
}
728x90