First Digit
Submissions: 1643   Accuracy:

18.73%

  Difficulty: Medium   Marks: 4

Given an array Arr[] of N numbers, you need to write a program to find the first digit(from left side) of product of these N integers.

Input:
First line of input contains an integer T which denotes the number of test cases. Then T test cases follows. First line of each test case contains a single integer N which denotes the number of elements in the array. Second line of each test case contains N space separated integers which denotes the elements of the array.

Output:
For each test case, in a new line, print the first digit of product of these N integers present in the array.

Constraints:
1 <= T <= 100
1 <= N <= 104
1 <= Arr[i] <= 105

Example:
Input:

2
4
5 8 3 7
3
6 7 9
Output:
8
3

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

Contributor: Harsh Agarwal
Author: harsh.agarwal0


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



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


to report an issue on this page.