
- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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 Questions & Answers
- Integer literals vs Floating point literals in C#
- What are literals in C++?
- What are Boolean Literals in C++?
- What are Character Literals in C++?
- What are string literals in C#?
- What are floating point literals in C#?
- What are string literals in C language?
- What are JSP literals?
- What are literals in Java?
- What are Perl Numerical Literals?
- What are Perl String Literals?
- What are Boolean literals in Java?
- What are C++ Integer Constants?
- What are binary literals and digit separators in C# 7.0?
- Define integer literals as octal values in Java
Advertisements