using System;
using System.Collections.Generic;
public class Solution {
public int[] solution(int n, int[] numlist) {
int[] answer = new int[] {};
List<int> array = new List<int>();
for(int i = 0; i < numlist.Length; i++)
{
if(numlist[i] % n == 0)
array.Add(numlist[i]);
}
answer = array.ToArray();
return answer;
}
}
'프로그래머스 > Lv.0' 카테고리의 다른 글
[프로그래머스 C#] n 번째 원소부터 (0) | 2023.09.03 |
---|---|
[프로그래머스 C#] n개 간격의 원소들 (0) | 2023.09.03 |
[프로그래머스 C#] 제곱수 판별하기 (0) | 2023.09.03 |
[프로그래머스 C#] 369게임 (0) | 2023.09.03 |
[프로그래머스 C#] 홀수 vs 짝수 (0) | 2023.08.30 |