“Contoh Kode Operator Modulo Python” Kode Jawaban

Contoh Kode Operator Modulo Python

# 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)
Outrageous Ostrich

Contoh Kode Operator Modulo Python

# 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 = " ")
Outrageous Ostrich

Jawaban yang mirip dengan “Contoh Kode Operator Modulo Python”

Pertanyaan yang mirip dengan “Contoh Kode Operator Modulo Python”

Lebih banyak jawaban terkait untuk “Contoh Kode Operator Modulo Python” di Python

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya