본문 바로가기
C++

[프로그래머스] 약수 구하기

by 띰쥬 2025. 9. 6.
728x90
반응형
SMALL

#include <string>
#include <vector>

using namespace std;

vector<int> solution(int n) {
    vector<int> answer;
    for(int i=1; i<n+1; i++){
        if(n%i==0)
            answer.push_back(i);
    }
    return answer;
}

728x90
반응형
LIST

댓글