📝
Get Remainder
Get Remainder입문 기초 문법 +5pts
Problem
Write a function that returns the remainder when dividing two numbers.
Examples
Input:
remainder(10, 3)Output:
1Input:
remainder(20, 7)Output:
6Explanation
이 문제는 **나머지 연산자(%)**를 학습합니다. 모듈로(modulo) 연산이라고도 하며, 프로그래밍에서 매우 자주 사용됩니다. **나머지 연산자 (%)** 왼쪽 숫자를 오른쪽 숫자로 나눈 나머지를 반환합니다: - 10 % 3 = 1 (10 = 3 × 3 + 1) - 20 % 7 = 6 (20 = 7 × 2 + 6) **나머지가 0인 경우** 숫자가 나누어 떨어지면 나머지는 0입니다: - 15 % 5 = 0 (15 = 5 × 3 + 0) **실용적인 활용** 1. **짝수/홀수 판별**: `n % 2 === 0`이면 짝수 2...
View detailed explanation →Key Concepts
나머지 연산자 (%) 모듈로 연산 나누어 떨어짐 확인 순환 인덱스
Time: O(1) Space: O(1)
solution.js
Ctrl + Enter
Run tests to see results here.