> For the complete documentation index, see [llms.txt](https://andreyakinshin.gitbook.io/problembookdotnet/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://andreyakinshin.gitbook.io/problembookdotnet/ru/math/rounding2-s.md).

# «Rounding2» (Решение)

## Ответ

```
 a =  b * (a/b) + (a%b)
 7 =  3 *   2   +   1
 7 = -3 *  -2   +   1
-7 =  3 *  -2   +  -1
-7 = -3 *   2   +  -1
```

## Объяснение

При целочисленном делении результат всегда округляется по направлению к нулю. При взятии остатка от деления должно выполняться следующее правило: `x mod y = x - (x / y) * y`.

[Задача](/problembookdotnet/ru/math/rounding2-p.md)
