> 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
