Timer is Running

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 <= 10^{4}

1 <= Arr[i] <= 10^{5}

**Example:
Input:**

2

4

5 8 3 7

3

6 7 9

8

3

**Explanation:**

**Testcase 1:** First digit of product of all the array elements will be 8.

**Testcase 2:** First digit of product of all given array elements will be 3.

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.

abnandi04 | 801 |

KshamaGupta | 412 |

srivastavad270 | 223 |

bhavyapratap56 | 206 |

anshusingh20112001 | 181 |

abnandi04 | 776 |

KshamaGupta | 296 |

srivastavad270 | 223 |

bhavyapratap56 | 206 |

afreensartaj131 | 170 |

blackshadows | 5362 |

Ibrahim Nash | 5244 |

akhayrutdinov | 5111 |

mb1973 | 4976 |

Quandray | 4748 |

Login to report an issue on this page.