Creative Commons License
This work is licensed under a Creative Commons Attribution 3.0 Unported License.

Wednesday, May 8, 2013

Divisibility


Problem: Check whether a given number n is divisible by another number m.

Solution in Python:

def is_divisible(n, m):
    """
    Author: Mayur P Srivastava
    """


    if m == 0:
        return False

    return n % m == 0

Concepts Learned: Maths

No comments:

Post a Comment