Advertisement
Guest User

Untitled

a guest
Dec 11th, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.38 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3. using System.Collections.Generic;
  4.     //tanislav Radkov 11:28 AM
  5. //Така си го представям, нямам възможност в момента да тествам. Но с тази промяна първата версия която изпрати би трябвало да премахне и 100
  6.  
  7. //Count ще намалее като махнеш първите 2-3 числа, но променливата ще пази първоначалната стойност и ще провериш и премахнеш и 100               
  8. class Program
  9.     {
  10.         public enum MonthsOfYear
  11.         {
  12.             January = 1,
  13.             February,
  14.             March,
  15.             April,
  16.             May,
  17.             June,
  18.             July,
  19.             August,
  20.             September,
  21.             October,
  22.             November,
  23.             December
  24.         }
  25.    
  26.         public static void PrintMonthFromInput(int month)
  27.         {
  28.             if(month < 1 || month > 12)
  29.             {
  30.                 Console.WriteLine("Invalid Month!");
  31.                 return;
  32.             }
  33.            
  34.             Console.WriteLine((MonthsOfYear)month);          
  35.         }
  36.    
  37.         static void Main(string[] args)
  38.         {
  39.             Console.WriteLine("Enter a number that corresponds to a month of the year:");
  40.             int month = Convert.ToInt32(1);
  41.             PrintMonthFromInput(month);
  42.         }
  43.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement