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