본문 바로가기
Portpolio/codingtest

프로그래머스 각도 합치기 풀이

by Peter Choi 2025. 2. 26.
반응형

https://school.programmers.co.kr/learn/courses/30/lessons/340206

 

프로그래머스

SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프

programmers.co.kr

C++

#include <iostream>

using namespace std;

int main(void) {
    int angle1;
    int angle2;
    cin >> angle1 >> angle2;
    
    int sum_angle = angle1 + angle2;
    cout << sum_angle%360 << endl;
    return 0;
}

 

자바

import java.util.Scanner;

public class Solution {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int angle1 = sc.nextInt();
        int angle2 = sc.nextInt();

        int sum_angle = angle1 + angle2;
        System.out.println(sum_angle%360);
    }
}

 

파이썬

angle1 = int(input())
angle2 = int(input())

sum_angle = angle1 + angle2
print(sum_angle%360)

반응형

댓글