kirililchev3

Month printer - Switch case

May 17th, 2018
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.33 KB | None | 0 0
  1. using System;
  2.  
  3.     class Program
  4.     {
  5.         private static void Main()
  6.         {
  7.         int monthNumber = int.Parse(Console.ReadLine());
  8.         string month;
  9.  
  10.         switch (monthNumber)
  11.         {
  12.             case 1:
  13.                 month = "January";
  14.                 break;
  15.  
  16.             case 2:
  17.                 month = "February";
  18.                 break;
  19.  
  20.             case 3:
  21.                 month = "March";
  22.                 break;
  23.  
  24.             case 4:
  25.                 month = "April";
  26.                 break;
  27.  
  28.             case 5:
  29.                 month = "May";
  30.                 break;
  31.  
  32.             case 6:
  33.                 month = "June";
  34.                 break;
  35.  
  36.             case 7:
  37.                 month = "July";
  38.                 break;
  39.  
  40.             case 8:
  41.                 month = "August";
  42.                 break;
  43.  
  44.             case 9:
  45.                 month = "September";
  46.                 break;
  47.  
  48.             case 10:
  49.                 month = "Octomber";
  50.                 break;
  51.  
  52.             case 11:
  53.                 month = "November";
  54.                 break;
  55.  
  56.             case 12:
  57.                 month = "December";
  58.                 break;
  59.  
  60.             default:
  61.                 month = "Error!";
  62.                 break;
  63.         }
  64.  
  65.         Console.WriteLine(month);
  66.        
  67.         }
  68.     }
Advertisement
Add Comment
Please, Sign In to add comment