Minh Nguyen - 5 months ago 37

C# Question

I know it is silly but I am wondering what is best way to get result like this:

`223231 => 1`

509048 => 8

348356 => 6

648353 => 3

Basically it will return the remainder from its nearest

`'xxxx0'`

Any idea to use Math

`(div, mode, bit operators...)`

Answer

just get the remainder when you divide the number by 10.

```
rem = number%10;
12345 % 10 = 5.
```