# Thread: Integer Division vs Modulo Operation

1. ## Integer Division vs Modulo Operation

In integer division&nbsp; 6 / 5 = 1.2&nbsp; with just the 1 being returned.&nbsp;<br><br>In modulo 6 % 5 = 1<br><br>On a calculator&nbsp; 6 % 5&nbsp; =&nbsp; 1.2&nbsp; &nbsp;<br><br>I was expecting the 1.2&nbsp; to be a 1.1&nbsp;&nbsp;<br><br>Am I missing something ?&nbsp;

2. Yep... In integer division 6/5 = 1 and you get 1 as remainder (not "modulo")...
6%5 gives you the remainder... here's a test... -6 mod 5 = 4 (positive) because the range is 5. As in:

0,1,2,3,4 - counting backwards 6 times from 0 to 4, 3, 2, 1... you'll get 4...

Code:
```\$ cc -x c -include stdio.h - <<< 'int main(void){printf("%d\n",-6%5);}'
\$ ./a.out
-1```
As you see, you get the remainder, not modulo.

3. PS: Python operator % will give you the modulo:

Code:
```\$ python -c 'print -6%5'
4```

4. Thanks for the reply. as you saw, my post was kinda unreadable. what tags do I add and how do I add them to make it more readable ?

5. To get you started...

&lt;&lt; !! Posting Code? Read this First !! &gt;&gt;

Some other tags are "quote" "url" and are used like this...

[Tag] ... [/Tag]