# function is defined for finding out
# the remainder of every number from 1 to n
def findRemainder(n, k):
for i in range(1, n + 1):
# rem will store the remainder
# when i is divided by k.
rem = i % k
print(i, "mod", k, "=", rem, sep = " ")
# Driver code
if __name__ == "__main__" :
# inputs
n = 10
k = 7
# function calling
findRemainder(n, k)
# floor devision and modulo
def euclidean_division(x, y):
quotient = x // y
remainder = x % y
print(f"{quotient} remainder {remainder}")
euclidean_division(1, 7000)
# finds both in one function
remainder = 31 % 10
>>> 15 % 4
3
>>> 17 % 12
5
>>> 240 % 13
6
>>> 10 % 16
10
# inputs
a = 435
b = 23
# Stores the remainder obtained
# when dividing a by b, in c
c = a % b
print(a, "mod", b, "=", c, sep = " ")
if i%2 == 0 :
print("the Number is Odd")
else:
print("the Number is even")