What are integer literals in C#?

CsharpProgrammingServer Side Programming

An integer literal can be a decimal, or hexadecimal constant. A prefix specifies the base or radix: 0x or 0X for hexadecimal, and there is no prefix id for decimal. It can also have a suffix that is a combination of U and L, for unsigned and long, respectively.

Here are some of the examples of integer literals −

200 // int
90u// unsigned int

Let’s use the above literal while declaring and initializing a variable −

// int
int a =200;

We will now print the values −


 Live Demo

using System;

namespace Demo {

   class Program {

      static void Main(string[] args) {

         // integer literal
         int a = 200;



Published on 10-Aug-2018 15:59:09