Advertisement
cd62131

Four Season

Mar 7th, 2014
497
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.55 KB | None | 0 0
  1. #include <stdio.h>
  2. int main(void) {
  3.   int month = 4;
  4.   switch (month) {
  5.     case 12: case 1: case 2:
  6.       puts("冬です"); break;
  7.     case 3: case 4: case 5:
  8.       puts("春です"); break;
  9.     case 6: case 7: case 8:
  10.       puts("夏です"); break;
  11.     case 9: case 10: case 11:
  12.       puts("秋です"); break;
  13.     default:
  14.       break;
  15.   }
  16.   int mdiv = month / 3;
  17.   if (mdiv == 0 || mdiv == 4) puts("冬です");
  18.   else if (mdiv == 1) puts("春です");
  19.   else if (mdiv == 2) puts("夏です");
  20.   else puts("秋です");
  21.   return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement