Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConsoleApp150
- {
- class Program
- {
- static void Main(string[] args)
- {
- while(true)
- {
- var input = Console.ReadLine();
- if(input=="END")
- {
- return;
- }
- int number = 0;
- char symbol = ' ';
- double floating = 0.0;
- bool isBool;
- if (int.TryParse(input, out number))
- {
- Console.WriteLine($"{number} is integer type");
- }
- else if (char.TryParse(input, out symbol))
- {
- Console.WriteLine($"{symbol} is character type");
- }
- else if (double.TryParse(input, out floating))
- {
- Console.WriteLine($"{floating} is floating point type");
- }
- else if (bool.TryParse(input, out isBool))
- {
- if (isBool == false)
- {
- string boolean = "false";
- Console.WriteLine($"{boolean} is boolean type");
- }
- else
- {
- string boolean = "true";
- Console.WriteLine($"{boolean} is boolean type");
- }
- }
- else
- {
- Console.WriteLine($"{input} is string type");
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement