Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace DifferentIntegersSize
- {
- class DifferentIntegersSize
- {
- static void Main(string[] args)
- {
- var s = Console.ReadLine();
- var types = string.Empty;
- if (sbyte.TryParse(s, out sbyte r1)) { types += "* sbyte\n"; }
- if (byte.TryParse(s, out byte r2)) { types += "* byte\n"; }
- if (short.TryParse(s, out short r3)) { types += "* short\n"; }
- if (ushort.TryParse(s, out ushort r4)) { types += "* ushort\n"; }
- if (int.TryParse(s, out int r5)) { types += "* int\n"; }
- if (uint.TryParse(s, out uint r6)) { types += "* uint\n"; }
- if (long.TryParse(s, out long r7)) { types += "* long\n"; }
- //if (ulong.TryParse(s, out ulong r8)) { types += "* ulong\n"; }
- if (types == string.Empty) { Console.WriteLine($"{s} can't fit in any type"); }
- else { Console.WriteLine($"{s} can fit in:\n{types}"); }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement