Arithmetic, DIV and MOD · 산술 연산, DIV 및 MOD
This page needs a recent browser (with SharedArrayBuffer support). Please update Chrome, Edge, Firefox or Safari to the latest version. · 이 페이지는 최신 브라우저(SharedArrayBuffer 지원)가 필요합니다. Chrome, Edge, Firefox 또는 Safari를 최신 버전으로 업데이트해 주세요.
The arithmetic operators
+-*/and^are the ordinary arithmetic operators./gives a real result, even when both numbers are integers.^raises to a power.
OUTPUT 6 + 2
OUTPUT 7 / 2
OUTPUT 2 ^ 10
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).
OUTPUT 17 DIV 5
OUTPUT 17 MOD 5
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.
OUTPUT INT(27.5415)
Common mistakes
- Write
17 DIV 5, notDIV(17, 5), on a 9618 paper. - Use parentheses when the order of a long expression matters.
Now you try
- Use
DIV,MODandINT.
Output 17 DIV 5 and 17 MOD 5, each on its own line. · 17 DIV 5과 17 MOD 5을 각각 별도의 줄에 출력하십시오.
Click Run to see the output here. · 출력을 보려면 '실행'을 클릭하세요.
Output the integer part of 27.5415. · 27.5415의 정수 부분을 출력하십시오.
Click Run to see the output here. · 출력을 보려면 '실행'을 클릭하세요.