Advertisement
EraySezgin

Untitled

May 26th, 2019
915
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.11 KB | None | 0 0
  1. using System;
  2.  
  3. namespace DataTypeFinder
  4. {
  5.     class Program
  6.     {
  7.         static void Main()
  8.         {
  9.             string command = Console.ReadLine();
  10.             while (command!="End")
  11.             {
  12.                 if (int.TryParse(command,out int number))
  13.                 {
  14.                     Console.WriteLine($"{command} is intiger type");
  15.                 }
  16.                 else if (double.TryParse(command,out double floatingNumber ))
  17.                 {
  18.                     Console.WriteLine($"{command} is floating point type");
  19.                 }
  20.                 else if (bool.TryParse(command,out bool check))
  21.                 {
  22.                     Console.WriteLine($"{command} is boolean type");
  23.                 }
  24.                 else if (char.TryParse(command,out char symbol))
  25.                 {
  26.                     Console.WriteLine($"{command} is character type");
  27.                 }
  28.                 else
  29.                 {
  30.                     Console.WriteLine($"{command} is string type");
  31.                 }
  32.                 command = Console.ReadLine();
  33.             }
  34.         }
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement