Like other programming languages, In C#, we can also defining various types of constants and printing their values.
Defining constant
A constant can be defined using const keyword, once constant is defined, it’s value can never be changed.
Syntax:
const data_type constant_name = value;
const float PI = 3.14f;
Example:
Input:
const int a = 10; //integer constant
Console.WriteLine("a: {0}", a);
Output:
a: 10
C# code to define various types of constants
Output