作業1.オオカミは何時ですか.午前、午前、午後、夜.

6445 ワード

 1 using System;

 2 using System.Collections.Generic;

 3 using System.Linq;

 4 using System.Text;

 5 

 6 namespace ConsoleApplication1

 7 {

 8     class Class1

 9     {

10         static void Main(string[] arge)

11         {

12             Console.Write("");

13             string s = Console.ReadLine();

14             int hour = Convert.ToInt32(s);

15 

16             if (hour >= 0 && hour < 6)

17             {

18                 Console.WriteLine(" "+hour+" ");

19             }

20             else if (hour >=6 && hour <=12)

21             {

22                 Console.WriteLine(" "+hour+" ");

23             }

24             else if (hour > 12 && hour <= 18)

25             {

26                 hour -= 12;

27                 Console.WriteLine(" "+hour+" ");

28 

29             }

30             else if (hour > 18 && hour < 24)

31             {

32                 hour -= 12;

33                 Console.WriteLine(" " + hour + " ");

34             }

35             else

36             {

37                 Console.WriteLine(" ");

38             }

39 

40 

41 

42         }

43     }

44 }