> For the complete documentation index, see [llms.txt](https://mentebinaria.gitbook.io/manual-da-linguagem-gnu-c/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mentebinaria.gitbook.io/manual-da-linguagem-gnu-c/6.-aritmetica/aritmetica-basica.md).

# Aritmética Básica

A aritmética básica em C é feita com os operadores binários usuais da álgebra: adição (‘+’), subtração (‘-’), multiplicação (‘\*’) e divisão (‘/’). O operador unário ‘-’ é usado para mudar o sinal de um número. O operador unário `+` também existe; ele retorna seu operando inalterado.

‘/’ é o operador de divisão, mas dividir inteiros pode não dar o resultado que você espera. Seu valor é um inteiro, que não é igual ao quociente matemático quando este é uma fração. Use ‘%’ para obter o resto inteiro correspondente, quando necessário. Veja [Divisão e Resto](#user-content-fn-1)[^1]. A divisão de ponto flutuante produz um valor o mais próximo possível do quociente matemático.

Esses operadores usam a sintaxe algébrica com a regra de precedência algébrica usual (veja [Gramática de Operadores Binários](#user-content-fn-1)[^1]) de que multiplicação e divisão são feitas antes de adição e subtração, mas você pode usar parênteses para especificar explicitamente como os operadores devem se aninhar. Eles são associativos à esquerda (veja[ Associatividade e Ordenação](#user-content-fn-1)[^1]). Assim,

```c
-a + b - c + d * e / f
```

é equivalente a

```c
(((-a) + b) - c) + ((d * e) / f)
```

[^1]: Capítulo pendente de tradução


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://mentebinaria.gitbook.io/manual-da-linguagem-gnu-c/6.-aritmetica/aritmetica-basica.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
