swirldev / swirl_courses

:mortar_board: A collection of interactive courses for the swirl R package.
http://swirlstats.com
Other
4.3k stars 7.25k forks source link

Remainder %% Function #439

Closed akmcmasters closed 4 years ago

akmcmasters commented 5 years ago

remainder <- function(num, divisor = 2) { num %% divisor }

submit()

| Sourcing your script...

| All that hard work is paying off!

|=================== | 33% | Let's do some testing of the remainder function. Run remainder(5) and see what happens.

remainder(5) [1] 1

| You are doing so well!

pls explain how the %% works to produce 1 from 5 %% 2

akmcmasters commented 4 years ago

5 is divisible by 2, 2 times = 4, the remainder %% = 1