
- C# Basic Tutorial
- C# - Home
- C# - Overview
- C# - Environment
- C# - Program Structure
- C# - Basic Syntax
- C# - Data Types
- C# - Type Conversion
- C# - Variables
- C# - Constants
- C# - Operators
- C# - Decision Making
- C# - Loops
- C# - Encapsulation
- C# - Methods
- C# - Nullables
- C# - Arrays
- C# - Strings
- C# - Structure
- C# - Enums
- C# - Classes
- C# - Inheritance
- C# - Polymorphism
- C# - Operator Overloading
- C# - Interfaces
- C# - Namespaces
- C# - Preprocessor Directives
- C# - Regular Expressions
- C# - Exception Handling
- C# - File I/O
- C# Advanced Tutorial
- C# - Attributes
- C# - Reflection
- C# - Properties
- C# - Indexers
- C# - Delegates
- C# - Events
- C# - Collections
- C# - Generics
- C# - Anonymous Methods
- C# - Unsafe Codes
- C# - Multithreading
- C# Useful Resources
- C# - Questions and Answers
- C# - Quick Guide
- C# - Useful Resources
- C# - Discussion
What are integer literals in C#?
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 −
Example
using System; namespace Demo { class Program { static void Main(string[] args) { // integer literal int a = 200; Console.WriteLine(a); } } }
Output
200
- Related Articles
- Integer literals vs Floating point literals in C#
- What are literals in Java?
- What are literals in C++?
- What are Literals in Python?
- What are JSP literals?
- What are Boolean literals in Java?
- What are Boolean Literals in C++?
- What are Character Literals in C++?
- What are string literals in C#?
- Define integer literals as octal values in Java
- What is the difference between integer and floating point literals in Java?
- What are Perl Numerical Literals?
- What are Perl String Literals?
- What are floating point literals in C#?
- What are string literals in C language?

Advertisements