Advertisement
cd62131

JapaneseCalendarToAD

Feb 11th, 2014
281
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.43 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. int main(void) {
  4.   char in[4];
  5.   int year;
  6.   scanf("%3s", in);
  7.   switch (in[0]) {
  8.   case 'm':
  9.   case 'M':
  10.     year = 1867;
  11.     break;
  12.   case 't':
  13.     case 'T':
  14.     year = 1911;
  15.     break;
  16.   case 's':
  17.     case 'S':
  18.     year = 1925;
  19.     break;
  20.   case 'h':
  21.     case 'H':
  22.     year = 1988;
  23.     break;
  24.   default:
  25.     exit(1);
  26.   }
  27.   printf("%d\n", year + atoi(in + 1));
  28.   return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement