프로그래밍

프로그래머스 C# 나이 출력(개쉬움, P, J)

노마드선샤인 2022. 12. 19. 22:05
728x90

using System;

public class Solution {
    public int solution(int age) {
        if (age > 120 || age <= 0) 
        {
            throw new Exception("invalid param");
        }
        return 2023-age;
    }
}

 

/////

파이썬

////

def solution(age):
    return 2023-age

 

자바

 

class Solution {
    public int solution(int age) {
        return 2022-age+1;
    }
}
728x90