Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace DataTypeFinder
- {
- class Program
- {
- static void Main(string[] args)
- {
- string input = Console.ReadLine();
- while (input != "END")
- {
- bool isInteger = int.TryParse(input, out int integer);
- bool isFloating = float.TryParse(input, out float floating);
- bool isCharacters = char.TryParse(input, out char character);
- bool isBolean = bool.TryParse(input, out bool boolean);
- if (isInteger)
- Console.WriteLine($"{integer} is integer type");
- else if (isFloating)
- Console.WriteLine($"{floating} is floating point type");
- else if (isCharacters)
- Console.WriteLine($"{character} is character type");
- else if (isBolean)
- Console.WriteLine($"{input} is boolean type");
- else
- Console.WriteLine($"{input} is string type");
- input = Console.ReadLine();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement