Advertisement
Grim666

Untitled

Jan 22nd, 2017
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.30 KB | None | 0 0
  1. using System;
  2. using System.Numerics;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7.  
  8. namespace DifferentIntSize
  9. {
  10. class Program
  11. {
  12. static void Main(string[] args)
  13. {
  14. BigInteger inputInt = BigInteger.Parse(Console.ReadLine());
  15.  
  16.  
  17.  
  18. int check = 0;
  19.  
  20. if (inputInt > sbyte.MinValue && inputInt < sbyte.MaxValue)
  21. {
  22. check++;
  23. if (check == 1)
  24. {
  25. Console.WriteLine(inputInt + " can fit in:");
  26. }
  27. Console.WriteLine("* sbyte");
  28. }
  29.  
  30. if (inputInt > byte.MinValue && inputInt < byte.MaxValue)
  31. {
  32. check++;
  33. if (check == 1)
  34. {
  35. Console.WriteLine(inputInt + " can fit in:");
  36. }
  37. Console.WriteLine("* byte");
  38. }
  39.  
  40. if (inputInt > short.MinValue && inputInt < short.MaxValue)
  41. {
  42. check++;
  43. if (check == 1)
  44. {
  45. Console.WriteLine(inputInt + " can fit in:");
  46. }
  47. Console.WriteLine("* short");
  48. }
  49.  
  50. if (inputInt > ushort.MinValue && inputInt < ushort.MaxValue)
  51. {
  52. check++;
  53. if (check == 1)
  54. {
  55. Console.WriteLine(inputInt + " can fit in:");
  56. }
  57. Console.WriteLine("* ushort");
  58. }
  59.  
  60. if (inputInt > int.MinValue && inputInt < int.MaxValue)
  61. {
  62. check++;
  63. if (check == 1)
  64. {
  65. Console.WriteLine(inputInt + " can fit in:");
  66. }
  67. Console.WriteLine("* int");
  68. }
  69.  
  70. if (inputInt > uint.MinValue && inputInt < uint.MaxValue)
  71. {
  72. check++;
  73. if (check == 1)
  74. {
  75. Console.WriteLine(inputInt + " can fit in:");
  76. }
  77. Console.WriteLine("* uint");
  78.  
  79. }
  80.  
  81. if (inputInt > long.MinValue && inputInt < long.MaxValue)
  82. {
  83. check++;
  84. if (check == 1)
  85. {
  86. Console.WriteLine(inputInt + " can fit in:");
  87. }
  88. Console.WriteLine("* long");
  89.  
  90. }
  91.  
  92. // if (inputInt > ulong.MinValue && inputInt < ulong.MaxValue)
  93. // {
  94. // check++;
  95. // if (check == 1)
  96. // {
  97. // Console.WriteLine(inputInt + " can fit in:");
  98. // }
  99. // Console.WriteLine("* ulong");
  100. //}
  101. if (check == 0)
  102. {
  103. Console.WriteLine(inputInt + " can't fit in any type");
  104.  
  105. }
  106. }
  107. }
  108. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement