0Pricing
C# Academy · Lesson

Numeric Types

int, double, decimal and more.

Why Numeric Types Matter

C# offers several numeric types, each storing a different range of values and using a different amount of memory.

Choosing the right one keeps your programs correct and efficient. A whole number like the count of users fits an int; a price needs decimals.

In this lesson you'll meet integers, floating-point, and decimal types.

Integer Types

Integers store whole numbers with no fractional part.

  • int — 32-bit, the everyday default
  • long — 64-bit, for very large counts
  • short and byte — smaller ranges

Use int unless a value can exceed about two billion.

int age = 30;
long population = 8000000000;
Console.WriteLine(age);
Console.WriteLine(population);

All lessons in this course

  1. Numeric Types
  2. Arithmetic and Precedence
  3. The Math Class
  4. Converting Between Numbers
← Back to C# Academy