Product of array elements
Submissions: 23653   Accuracy:

40.8%

  Difficulty: Basic   Marks: 1

This is a functional problem . Your task is to return the product of array elements under a given modulo.
The modulo operation finds the remainder after division of one number by another. For example, K(mod(m))=K%m= remainder obtained when K is divided by m.

Input:

The first line of input contains T denoting the number of testcases.Then each of the T lines contains a single positive integer N denotes number of element in array. Next line contain 'N' integer elements of the array.


Output:

Return the product of array elements under a given modulo.
That is, return (Array[0]*Array[1]*Array[2]...*Array[n])%modulo.


Constraints:


1<=T<=200

1<=N<=10^5

1<=ar[i]<=10^5

Example:

Input:

1

4

1 2 3 4

Output:

24

** For More Input/Output Examples Use 'Expected Output' option **

Author: sumit.chauhan


Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.

to report an issue on this page.