프로그래머스 120813 짝수는 싫어요

Jmnote (토론 | 기여)님의 2023년 11월 9일 (목) 00:56 판

1 개요

프로그래머스 120813 짝수는 싫어요

2 C++

#include <string>
#include <vector>

using namespace std;

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

3 같이 보기