# 1.7: Integers

In this module we'll discuss integers and a few operators used with integers.

## File Location

Create another console app for this section: 1. Right click on the solution you made in the first module. 2. Go to **Add > New Project** and select **Console App (.NET Framework)** 3. Name it `0.01_Types_Integers` 4. Write your code for this module within `Program.cs` of that project 5. Set this application to start up.

## Description

Integers are C#'s representation of numerals. There are different variable types of integers, click [here](/dotnet-101-csharpfundamentals/part-1-data-types/1.2-data-types-table.md) for a table that goes into more specific sizes and ranges. You can use different types to more efficiently run your program.

## Discussion

It is important to understand the different data types within C#. For example, `one` is not equal to `1`. The word *'one'* would be a `string` while the number *'1'* would be an `int`. C# has us specify these types for us to move them around or manipulate them. There are different conversions and methods we can attach to data types which we can briefly go over.

## Visual Representation

```csharp
    class Program
    {
    //  1   2   3
        int i = 0;
    }
```

1. Data type
2. Variable name
3. Value Associated to Data type

## Operators

You can also do math using the operators `+ - * /`. For example:

```csharp
Console.WriteLine(5 + 2) //result = 7
Console.WriteLine(10 - 6) //result = 4
Console.WriteLine(2 * 3) //result = 6
Console.WriteLine(10 / 2) //result = 5
```

## Modulus

There is another common operator called modulus - `%`. This is not a percentage, but the remainder when two numbers are divided. For example:

```csharp
Console.WriteLine(10 % 2) //result = 0 (10/2 = 5 w/ remainder of 0)
Console.WriteLine(10 % 9) //result = 1 (10/9 = 1 w/ remainder of 1)
Console.WriteLine(16 % 3) //result = 1 (16/3 = 5 w/ remainder of 1)
Console.WriteLine(19 % 5) //result = 4 (19/5 = 3 w/ remainder of 4)
```

`%` can be used to easily determine if a number is even or odd, even numbers % 2 are always 0.

In your `Program.cs` file in the `DataTypes` project, practice using the different operators and just do some basic math. See if you can calculate a tip for a restaurant bill.

[Next:](https://github.com/ElevenfiftyAcademy/DotNet-101-151-CSharpFundamentalsApps/tree/3de41b9a2fa9d172de1cb9178a4d8c651e8da0a9/docs/Part1/1.8-Integers.md) Integers


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://eleven-fifty-academy.gitbook.io/dotnet-101-csharpfundamentals/part-1-data-types/1.7-integers.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
