# Maximum value in a bitonic array

QUESTION

Given an array of elements which is first increasing and then decreasing, find the maximum element in the array.\n\nInput:\n\nThe first line of input contains an integer T denoting the number of test cases.\nThe first line of each test case is N, the size of array\nThe second line of each test case contains N integers which are the array elements.\n\nOutput:\n\nPrint the maximum element in the array.\n\n\nConstraints:\n\n1<=T<=50\n3<=N<=100\n1<=a[i]<=100000.

“TESTCASE_1”: “2\n9\n1 15 25 45 42 21 17 12 11\n5\n1 45 47 50 5\n###—###SEPERATOR—###—\n45\n50”, “TESTCASE_2”: “2\n7\n11 29 48 60 55 39 9\n5\n34 67 89 47 22\n###—###SEPERATOR—###—\n60\n89”, “TESTCASE_3”: “0\n###—###SEPERATOR—###—\n0”, “TESTCASE_4”: “0\n###—###SEPERATOR—###—\n0”, “TESTCASE_5”: “0\n###—###SEPERATOR—###—\n0

``````#include <stdio.h>
int main()
{int n,t,i,max=0;
scanf("%d",&t);
while(t--)
{
scanf("%d",&n);
int a[n];
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
max=a[0];
for(i=0;i<n;i++)
{
if(a[i]>max)
max=a[i];
}
printf("%d\n",max);
max=0;
}

return 0;
}``````