Arithmetic, DIV and MOD · Aritmética, DIV e MOD
This page needs a recent browser (with SharedArrayBuffer support). Please update Chrome, Edge, Firefox or Safari to the latest version. · Esta página precisa de um navegador recente (com suporte a SharedArrayBuffer). Por favor, atualize Chrome, Edge, Firefox ou Safari para a versão mais recente.
English
The arithmetic operators
+-*/and^are the ordinary arithmetic operators./gives a real result, even when both numbers are integers.^raises to a power.
Português
Os operadores aritméticos
+,-,*,/e^são os operadores aritméticos usuais./dá um resultado real, mesmo quando ambos os números são inteiros.^eleva à potência.
OUTPUT 6 + 2
OUTPUT 7 / 2
OUTPUT 2 ^ 10
English
DIV and MOD sit between the numbers
DIVis integer division: how many whole times one number fits into another.MODis the remainder.- In this guide they are written between the two numbers:
17 DIV 5,17 MOD 5. - That is not how IGCSE 0478 writes them. There they are functions,
DIV(17, 5).
Português
DIV e MOD ficam entre os números
DIVé divisão inteira: quantas vezes inteiras um número cabe no outro.MODé o resto.- Neste guia eles são escritos entre os dois números:
17 DIV 5,17 MOD 5. - Isso não é como o IGCSE 0478 os escreve. Nele são funções,
DIV(17, 5).
English
Português
OUTPUT 17 DIV 5
OUTPUT 17 MOD 5
English
INT drops the fractional part
INT(x)returns the integer part of a real.INT(27.5415)is27.RAND(n)returns a real from 0 up to, but not including,n. A paper uses it when the result may vary.
Português
INT remove a parte fracionária
INT(x)retorna a parte inteira de um real.INT(27.5415)é27.RAND(n)retorna um real de 0 até, mas sem incluir,n. Um papel o usa quando o resultado pode variar.
OUTPUT INT(27.5415)
English
Common mistakes
- Write
17 DIV 5, notDIV(17, 5), on a 9618 paper. - Use parentheses when the order of a long expression matters.
Português
Erros comuns
- Escreva
17 DIV 5, nãoDIV(17, 5), em um papel 9618. - Use parênteses quando a ordem de uma expressão longa for importante.
English
Now you try
- Use
DIV,MODandINT.
Português
Agora você tenta
- Use
DIV,MODeINT.
Output · Saída 17 DIV 5 and · e 17 MOD 5, each on its own line. · Imprima 17 DIV 5 e 17 MOD 5, cada um em sua própria linha.
Click Run to see the output here. · Clique em Executar para ver a saída aqui.
Output the integer part of 27.5415. · Imprima a parte inteira de 27.5415.
Click Run to see the output here. · Clique em Executar para ver a saída aqui.