xFactorSchool.com(Beta)
How to Do Examples
Python Examples
HTML Examples
Code Examples
C Code Examples
C++ Code Examples
C# Code Examples
Java Code Examples
Python Code Examples
HTML Code Examples
CSS Code Examples
JavaScript Code Examples
Online Editor
C Code Editor
C++ Code Editor
C# Code Editor
Java Code Editor
Python Code Editor
HTML Code Editor
CSS Code Editor
JavaScript Code Editor
Practice how to create different data types in C#
C# Online Editor
Execute Code
More C# Sample Code
using System; namespace ExampleApp { class Program { static void Main(string[] args) { // Declare and initialize variables of different data types char charVariable = 'A'; // Character data Console.WriteLine(charVariable + " is a character data"); // output: A is a character data string stringVariable = "Hello C#"; // String data Console.WriteLine(stringVariable + " is a string data"); // output: Hello C# is a string data int integerVariable = 10; // Integer data Console.WriteLine(integerVariable + " is an integer data"); // output: 10 is an integer data decimal decimalVariable = 123.45m; Console.WriteLine( decimalVariable + " is a decimal data"); // output: 123.45 is a decimal data float floatVariable = 3.14f; // Single-precision floating-point data Console.WriteLine( floatVariable + " is a float data"); // output: 3.14 is a float data double doubleVariable = 2.71828; // Double-precision floating-point data Console.WriteLine( doubleVariable + " is a double data"); // output: 2.71828 is a double data bool boolVariable = true; // Boolean data Console.WriteLine(boolVariable + " is a boolean data"); // output: True is a boolean data } } }