Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace DataTypeFinder
- {
- class Program
- {
- static void Main()
- {
- string command = Console.ReadLine();
- while (command!="End")
- {
- if (int.TryParse(command,out int number))
- {
- Console.WriteLine($"{command} is intiger type");
- }
- else if (double.TryParse(command,out double floatingNumber ))
- {
- Console.WriteLine($"{command} is floating point type");
- }
- else if (bool.TryParse(command,out bool check))
- {
- Console.WriteLine($"{command} is boolean type");
- }
- else if (char.TryParse(command,out char symbol))
- {
- Console.WriteLine($"{command} is character type");
- }
- else
- {
- Console.WriteLine($"{command} is string type");
- }
- command = Console.ReadLine();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment