teddy8 Full Stack Software Engineer

CodeUp - 기초100제(1070)

2019-06-20
teddy8

문제

URL : https://codeup.kr/problemsetsol.php?psid=23


소스코드

// 달 입력받아 계절 출력하기
// input : 12
// output : winter
// 월별계절
// 12, 1, 2  : winter
// 3, 4, 5   : spring
// 6, 7, 8   : summer
// 9, 10, 11 : fall

#include <iostream>

using namespace std;

int main()
{
	int n;
	cin >> n;

	switch (n) {
	case 12: case 1:  case 2:   cout << "winter" << endl; break;
	case 3:  case 4:  case 5:   cout << "spring" << endl; break;
	case 6:  case 7:  case 8:   cout << "summer" << endl; break;
	case 9:  case 10: case 11:  cout << "fall" << endl; break;
	default: cout << "1 ~ 12로 입력해주세요." << endl; break;
	}

	return 0;
}


Comments

Content