In this example, I have shared Python Program for Find reminder of array multiplication divided by n.
Problem statement
Given multiple numbers and a number input n, we need to print the remainder after multiplying all the number divisible by n.
Solution:
1 2 3 4 5 6 7 8 9 10 11 | def findremainder(arr, lens, n): mul = 1 # find the individual remainder for i in range(lens): mul = (mul * (arr[i] % n)) % n return mul % n # Driven code arr = [100,1,2,3,4,5,6,6,7] lens = len(arr) n = 11 print( findremainder(arr, lens, n)) |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.