bunny code 2024. 4. 16. 22:48

Q. 2022년 기준 선생님의 나이 age가 주어질 때, 선생님의 출생 연도를 return 하는 solution 함수를 완성해주세요

(조건 : 0 < age ≤ 120, 나이는 태어난 연도에 1살이며 매년 1월 1일마다 1살씩 증가합니다.)

더보기

#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>

int solution(int age) {
    int answer = 0;
    return answer;
}

A.

더보기

#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>

int solution(int age) {
    int answer = 0;
    answer = 2023-age;
    return answer;
}