# Missing number in the array

QUESTION

Given an array of size n-1 and given that there are numbers from 1 to n with one missing, the missing number is to be found.\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,size of array.\nThe second line of each test case contains N-1 input C[i],numbers in array.\n\nOutput:\n\nPrint the missing number in array.\n\nConstraints:\n\n1<=T<=100\n1<=N<=1000\n1<=C[i]<=1000.

“TESTCASE_1”: “2\n5\n1 2 3 5\n10\n1 2 3 4 5 6 7 8 10\n###—###SEPERATOR—###—\n4\n9”, “TESTCASE_2”: “2\n4\n1 3 4\n5 \n1 2 4 5\n###—###SEPERATOR—###—\n2\n3”, “TESTCASE_3”: “0\n###—###SEPERATOR—###—\n0”, “TESTCASE_4”: “0\n###—###SEPERATOR—###—\n0”, “TESTCASE_5”: “0\n###—###SEPERATOR—###—\n0

``````#include <iostream>
using namespace std;
int main()
{
int i,n,a[100][100],m,j;
cin>>m;
for(i=1;i<=m;i++)
{
//cout<<endl;
cin>>n;
for(j=1;j<n;j++)
{
//cout<<j;
cin>>a[i][j];
}
for(j=1;j<=n;j++)
{
//cout<<a[i][j]<<" ";
}

for(j=1;j<=n;j++)
{
//cout<<"a[i][j]"<<i<<" "<<j<<" "<<a[i][j]<<endl;
if(a[i][j]!=j)
{
cout<<j<<endl;
break;
}
}
}
return 0;
}``````