코딩테스트/프로그래머스 - LV 0

[프로그래머스] flag에 따라 다른 값 반환하기

웅드 2024. 1. 23. 14:48

 

 

  • 풀이
#include <string>
#include <vector>

using namespace std;

int solution(int a, int b, bool flag) {
    return flag ? a + b : a-b;
}
반응형