As in other programming languages, various types of constants are defined the same as defined in C#, we can also define various types of constants and print their values. They are fixed in values in the program. There can be any types of constants like integer, character constants, float, double, string, octal, hexadecimal, etc.
Define constant: By using const keyword a constant can be defined. Its value can never be changed once it is defined.
const data_type constant_name = value;
Input: const int a = 15; Output: a: 15
A: 15 B: 50.83
C: S D: 70.23 E: Geeks
- Role of SemiColon in various Programming Languages
- C# | Data Types
- C# | Types of Variables
- Types of Threads in C#
- What is Anonymous Types in C#?
- Different Types of HTML Helpers in ASP.NET MVC
- C# | Nullable types
- Hello World Program : First program while learning Programming
- Program to convert Byte array to IP Address
- C# Program for Naive algorithm for Pattern Searching
- C# Program for KMP Algorithm for Pattern Searching
- C# Program to print all permutations of a given string
- C# Program for Count Inversions in an array | Set 1 (Using Merge Sort)
- C# Program for Median of two sorted arrays of same size
- C# Program for Activity Selection Problem | Greedy Algo-1
- C# Program for Subset Sum Problem | DP-25
- C# Program for Dijkstra's shortest path algorithm | Greedy Algo-7
- C# Program for Maximum sum rectangle in a 2D matrix | DP-27
- C# Program for Largest Sum Contiguous Subarray
- C# Program for Maximum size square sub-matrix with all 1s
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.