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를 최신 버전으로 업데이트해 주세요.
English
Arithmetic operators
- Pseudocode uses
+-*/and^for the usual maths. /gives a real answer (with a decimal point).
한국어
산술 연산자
- 가짜 코드는 일반적인 수학 연산을 위해
+,-,*,/및^를 사용합니다. /은 실수(real) 결과를 제공합니다(소수점 포함).
OUTPUT 6 + 2 // → 8
OUTPUT 6 * 2 // → 12
OUTPUT 7 / 2 // → 3.5
English
^ raises to a power
^means "to the power of".2 ^ 10is 2 multiplied by itself ten times, which is1024.- The syllabus lists it beside
+,-,*and/.
한국어
^는 거듭제곱을 높입니다
^는 "지수"를 의미합니다.2 ^ 10은 2가自身의 10배 곱해진 값이며, 이는1024입니다.- 교육 과정은 이를
+,-,*및/옆에 나열하고 있습니다.
OUTPUT 2 ^ 10 // → 1024
English
DIV: whole-number division
DIV(a, b)divides and throws the remainder away.DIV(17, 5)is3— 5 goes into 17 three whole times.- It is written like a function, with the two numbers in brackets — not between them.
한국어
DIV: 정수除法
- **
DIV(a, b)**은 나누고 나머지는 버립니다. DIV(17, 5)은3입니다. 5은 17에 정수 3번 들어갑니다.- 함수처럼 쓰이며 두 숫자가 괄호 안에 있습니다 — 그 사이에 두지 않습니다.
OUTPUT DIV(17, 5) // → 3
English
MOD: the remainder
MOD(a, b)gives the remainder after dividing.MOD(17, 5)is2. A number is even whenMOD(N, 2) = 0.
한국어
MOD: 나머지
- **
MOD(a, b)**은 나누기 후 나머지를 줍니다. MOD(17, 5)은2입니다. 수가 짝수일 때MOD(N, 2) = 0입니다.
OUTPUT MOD(17, 5) // → 2
English
Watch out
DIVandMODwork on whole numbers; plain/gives a decimal.- Together they "undo" a division:
DIV(17, 5) * 5 + MOD(17, 5)=17.
한국어
주의사항
DIV과MOD은 정수에서 작동하며, 평범한/는 소수를 제공합니다.- 함께 나누기의 반대로 작용합니다:
DIV(17, 5) * 5 + MOD(17, 5)=17.
English
Common mistakes
DIV(a, b)is whole-number division;MOD(a, b)is the remainder. Both are written with brackets.- Use brackets to control the order of arithmetic.
한국어
흔한 실수
DIV(a, b)은 정수除法;MOD(a, b)은 나머지입니다. 둘 다 괄호로 씁니다.- 산술 연산 순서를 제어하기 위해 괄호를 사용하십시오.
English
Now you try
- Use
+ - * / ^, and the functionsDIV(a, b)/MOD(a, b). - Press Check answer to test it.
한국어
이제 직접 해보기
+ - * / ^을 사용하고, 함수DIV(a, b)/MOD(a, b)을 활용하십시오.- 답안 확인을 눌러 테스트해 보십시오.
Output 6 times 7 (the answer is 42). · 6 × 7의 결과를 출력합니다. (정답은 42입니다.)
Click Run to see the output here. · 출력을 보려면 '실행'을 클릭하세요.
Use DIV(20, 3) to output how many whole times 3 goes into 20 (the answer is 6). · DIV(20, 3)를 사용하여 3이 20에 몇 번 완전히 들어가는지 출력합니다. (정답은 6입니다.)
Click Run to see the output here. · 출력을 보려면 '실행'을 클릭하세요.
Use MOD(23, 5) to output the remainder when 23 is divided by 5 (the answer is 3). · MOD(23, 5)를 사용하여 23을 5으로 나눈 나머지를 출력합니다. (정답은 3입니다.)
Click Run to see the output here. · 출력을 보려면 '실행'을 클릭하세요.
Use ^ to output 2 to the power of 10 (the answer is 1024). · ^를 사용하여 2의 10제곱을 출력합니다. (정답은 1024입니다.)
Click Run to see the output here. · 출력을 보려면 '실행'을 클릭하세요.