Algorithm
In C#, variables are used to store and manipulate data, and each variable has a specific data type that defines the kind of data it can hold. C# supports various primitive data types, which are the basic building blocks for creating variables. Here are some common primitive data types in C#:
- 
Numeric Types: - 
Integer Types: - int: 32-bit signed integer. Example:- int myInteger = 42;
- short: 16-bit signed integer. Example:- short myShort = 10;
- long: 64-bit signed integer. Example:- long myLong = 1000000000L;
 
- 
Floating-Point Types: - float: 32-bit single-precision floating-point. Example:- float myFloat = 3.14f;
- double: 64-bit double-precision floating-point. Example:- double myDouble = 2.71828;
- decimal: 128-bit decimal type. Example:- decimal myDecimal = 123.456m;
 
 
- 
- 
Character Type: - char: 16-bit Unicode character. Example:- char myChar = 'A';
 
- 
Boolean Type: - bool: Represents true or false values. Example:- bool isTrue = true;
 
- 
String Type: - string: Represents a sequence of characters. Example:- string myString = "Hello, C#";
 
- 
Other Types: - byte: 8-bit unsigned integer. Example:- byte myByte = 255;
- sbyte: 8-bit signed integer. Example:- sbyte mySByte = -128;
- ushort: 16-bit unsigned integer. Example:- ushort myUShort = 65535;
- uint: 32-bit unsigned integer. Example:- uint myUInt = 4294967295U;
- ulong: 64-bit unsigned integer. Example:- ulong myULong = 18446744073709551615UL;
 
Code Examples
#1 C# programming Primitive Data Types (Boolean (bool))
Code -
                                                        C# Programming
using System;
namespace DataType
{
    class BooleanExample
    {
        public static void Main(string[] args)
        {
            bool isValid = true;
            Console.WriteLine(isValid);
        }
    }
}Output
#2 Signed Integral Values
Code -
                                                        C# Programming
using System;
namespace DataType
{
    class SByteExample
    {
        public static void Main(string[] args)
        {
            sbyte level = 23;
            Console.WriteLine(level);
        }
    }
}Output
#3 Signed Integral Values
Code -
                                                        C# Programming
using System;
namespace DataType
{
    class ShortExample
    {
        public static void Main(string[] args)
        {
            short value = -1109;
            Console.WriteLine(value);
        }
    }
}Output
#4 Code Example with C# Programming
Code -
                                                        C# Programming
using System;
namespace DataType
{
    class IntExample
    {
        public static void Main(string[] args)
        {
            int score = 51092;
            Console.WriteLine(score);
        }
    }
}Output
#5 Code Example with C# Programming
Code -
                                                        C# Programming
using System;
namespace DataType
{
    class LongExample
    {
        public static void Main(string[] args)
        {
            long range = -7091821871L;
            Console.WriteLine(range);
        }
    }
}Output
#6 Decimal
Code -
                                                        C# Programming
using System;
namespace DataType
{
    class DecimalExample
    {
        public static void Main(string[] args)
        {
         decimal bankBalance = 53005.25M;
            Console.WriteLine(bankBalance);
        }
    }
}Output
Demonstration
C# Programming Variables and (Primitive) Data Types
