Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Sandbox

Comments on Recreate modulo [cancelled]

Post

Recreate modulo [cancelled]

+0
−0

Recreate the modulo operation via function or program.

Mechanics:

  • The modulo operator involves division and returns the remainder.
  • For a function, use 2 variables as foo(a,b) such that $x \mod y$.
  • For a program, take 2 variables as input where a b is $x \mod y$.
  • Use standard division and return the remainder without using a built-in modulo operator.

Rules:

  • Standard loopholes are forbidden.
  • Shortest code in bytes wins.
History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.

1 comment thread

General comments (6 comments)
General comments
hyper-neutrino‭ wrote over 3 years ago

what are 1 % 2, -1 % 2, 1 % -2, and -1 % -2?

Razetime‭ wrote over 3 years ago

this is extremely trivial in most languages and is oftentimes a very basic elementary operation in challenges.

Skipping 1 deleted comment.

General Sebast1an‭ wrote over 3 years ago · edited over 3 years ago

hyper-neutrino‭ in Python, it seems to work this way: Try it online!

General Sebast1an‭ wrote over 3 years ago

Razetime‭ I don't know what trivial means here, but I won't post this challenge until it's favorable enough.

hyper-neutrino‭ wrote over 3 years ago

I know how it works in Python. But you didn't specify it in your question itself. Also I agree with Razetime that this is extremely trivial - most language have this as a builtin so solutions will all just use that, and only a handful of strange esolangs might have an interesting solution.

General Sebast1an‭ wrote over 3 years ago

hyper-neutrino‭ so this challenge will be abandoned.