Discussions

SmileBASIC Community

Erryestherrose123

07/25/2016 3:36 PM ·Spoilers

Open Closed

Divisibility

How do I calculate if a number is divisible by a certain number?

Advertisement

Comment

This post has no comments.

  • It's very simple! You probably already know that a number is divisible by another if the remainder of their division is 0. The MOD operator returns this remainder, so you can do something as simple as... NUM1 MOD NUM2 == 0 ...to check if NUM1 is divisible by NUM2.

    Yeahs1
    Played
  • Please be aware that the MOD operator only works with whole numbers (integers) and possibly only positive numbers. If you try using decimal values, they will be rounded off first. If you really need it to work with decimals, you can probably develop a custom algorithm pretty easily.

    Yeahs0
    Played
  • Oh ok! Thanks for your help! I'm new to all of this and you're always helping me out!

    Yeahs0
    Played

Add a Comment

You must sign in to post a comment.

Sign in using a Nintendo Network ID to connect to users around the world by writing posts and comments and by giving Yeahs to other people's posts. You can create a Nintendo Network ID using your Wii U console or your system in the Nintendo 3DS family.

Use of Miiverse Details about Miiverse

Report Violation to Miiverse Administrators

You are about to report a post with content which violates the Miiverse Code of Conduct. This report will be sent to Nintendo's Miiverse administrators and not to the creator of the post.

Violation Type:

Post ID: 3DB-NBL7-EJ9-9E2A-6RJ-D4AH

Report Violation to Miiverse Administrators

You cannot report posts made automatically by a software title.

Edit Post

Select an action: