Guest User

Untitled

a guest
Jul 19th, 2014
317
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace ConsoleApplication1
  7. {
  8. class Program
  9. {
  10. static void Main(string[] args)
  11. {
  12. int years;
  13. int months;
  14. int days;
  15.  
  16. Console.WriteLine("inserd date in this formad dd/mm/yyyy: ");
  17. Console.WriteLine("Days: ");
  18. days = int.Parse(Console.ReadLine());
  19. Console.WriteLine("Months: ");
  20. months = int.Parse(Console.ReadLine());
  21. Console.WriteLine("Years: ");
  22. years = int.Parse(Console.ReadLine());
  23.  
  24. int dayz;
  25. switch (months)
  26. {
  27. case 1:
  28. case 3:
  29. case 5:
  30. case 7:
  31. case 8:
  32. case 10:
  33. case 12:
  34. dayz = 31;
  35. break;
  36. case 4:
  37. case 6:
  38. case 9:
  39. case 11:
  40. dayz = 30;
  41. break;
  42. case 2:
  43. if (((years % 4 == 0) && !(years % 100 == 0)) || (years % 400 == 0))
  44. dayz = 29;
  45. else dayz = 28;
  46. break;
  47. default: Console.WriteLine("Not Valid Month!");
  48. dayz = 0;
  49. break;
  50. }
  51.  
  52. Console.WriteLine("Number Of Days: " + days);
  53.  
  54. if (years <= 9999 && years >= 0 && months >= 1 && months <= 12 && days >= 1 && days <= 31)
  55. Console.WriteLine("date inserted correctly");
  56.  
  57.  
  58.  
  59. else
  60. {
  61. Console.WriteLine("date inserted incorrect");
  62.  
  63. }
  64.  
  65.  
  66.  
  67. if (months == 1 || months == 3 || months == 5 || months == 7 || months == 8 || months == 10 || months == 12)
  68. Console.WriteLine("Number of days untill end of month: " + (31 - days));
  69.  
  70. if (months == 1)
  71. Console.WriteLine("Number of days untill end of year: " + (364 - days));
  72. if (days == 31)
  73. Console.WriteLine("The next day: 1/2/ " + years);
  74. else
  75. Console.WriteLine("The next day: " + (days+1) + "/1/" + years);
  76.  
  77. if (months == 2)
  78. Console.WriteLine("Number of days untill end of year: " + (364 - 31 - dayz - days));
  79. if (days == dayz)
  80. Console.WriteLine("The next day: 1/3/ " + years);
  81. else
  82. Console.WriteLine("The next day: " + (days + 1) + "/2/" + years);
  83. if (months == 3)
  84. Console.WriteLine("Number of days untill end of year: " + (364 - 31 - dayz - 31 - days));
  85. if (days == 31)
  86. Console.WriteLine("The next day: 1/4/ " + years);
  87. else
  88. Console.WriteLine("The next day: " + (days + 1) + "/3/" + years);
  89. if (months == 4)
  90. Console.WriteLine("Number of days untill end of year: " + (364 - 31 - dayz - 31 - 30 - days));
  91. if (days == 30)
  92. Console.WriteLine("The next day: 1/5/ " + years);
  93. else
  94. Console.WriteLine("The next day: " + (days + 1) + "/4/" + years);
  95. if (months == 5)
  96. Console.WriteLine("Number of days untill end of year: " + (364 - 31 - dayz - 31 - 30 - 31 - days));
  97. if (days == 31)
  98. Console.WriteLine("The next day: 1/6/ " + years);
  99. else
  100. Console.WriteLine("The next day: " + (days + 1) + "/5/" + years);
  101. if (months == 6)
  102. Console.WriteLine("Number of days untill end of year: " + (364 - 31 - dayz - 31 - 30 - 31 - 30 - days));
  103. if (days == 30)
  104. Console.WriteLine("The next day: 1/7/ " + years);
  105. else
  106. Console.WriteLine("The next day: " + (days + 1) + "/6/" + years);
  107. if (months == 7)
  108. Console.WriteLine("Number of days untill end of year: " + (364 - 31 - dayz - 31 - 30 - 31 - 30 - 31 - days));
  109. if (days == 31)
  110. Console.WriteLine("The next day: 1/8/ " + years);
  111. else
  112. Console.WriteLine("The next day: " + (days + 1) + "/7/" + years);
  113. if (months == 8)
  114. Console.WriteLine("Number of days untill end of year: " + (364 - 31 - dayz - 31 - 30 - 31 - 30 - 31 - 31 - days));
  115. if (days == 31)
  116. Console.WriteLine("The next day: 1/9/ " + years);
  117. else
  118. Console.WriteLine("The next day: " + (days+1) + "/8/" + years);
  119. if (months == 9)
  120. Console.WriteLine("Number of days untill end of year: " + (364 - 31 - dayz - 31 - 30 - 31 - 30 - 31 - 31 - 30 - days));
  121. if (days == 30)
  122. Console.WriteLine("The next day: 1/10/ " + years);
  123. else
  124. Console.WriteLine("The next day: " + (days + 1) + "/9/" + years);
  125. if (months == 10)
  126. Console.WriteLine("Number of days untill end of year: " + (364 - 31 - dayz - 31 - 30 - 31 - 30 - 31 - 31 - 30 - 31 - days));
  127. if (days == 31)
  128. Console.WriteLine("The next day: 1/11 " + years);
  129. else
  130. Console.WriteLine("The next day: " + (days + 1) + "/10/" + years);
  131. if (months == 11)
  132. Console.WriteLine("Number of days untill end of year: " + (364 - 31 - dayz - 31 - 30 - 31 - 30 - 31 - 31 - 30 - 31 - 30 - days));
  133. if (days == 30)
  134. Console.WriteLine("The next day: 1/12 " + years);
  135. else
  136. Console.WriteLine("The next day: " + (days + 1) + "/11/" + years);
  137. if (months == 12)
  138. Console.WriteLine("Number of days untill end of year: " + (364 - 31 - dayz - 31 - 30 - 31 - 30 - 31 - 31 - 30 - 31 - 30 - 31 - days));
  139. if (days == 31)
  140. Console.WriteLine("The next day: 1/1/ " + (years + 1));
  141. else
  142. Console.WriteLine("The next day: " + (days + 1) + "/12/" + years);
  143.  
  144.  
  145. }
  146. }
  147. }
RAW Paste Data