Max value in array

code executed successfully but showing wrong output
#include
using namespace std;
int maxnum()
{
signed int n;
cin>>n;

int *arr=new int[n];
int maximum=0;
for(int i=0;i<n;i++)
{
if(arr[i]>(-10^9) && arr[i]<(10^9))
{
cin>>arr[i];
}
}
for(int j=0;j<n;j++)
{
if (maximum>arr[j])
{
maximum=arr[j];
}
}
return maximum;
}
int main()
{
int z=maxnum();
cout<<z;
return 0;
}

@GreatCoderboy123
Remove the condition
if (arr[i] > (-10 ^ 9) && arr[i] < (10 ^ 9) )

because of two reasons.

  1. There is absolutely no need to even put it in the first place.
  2. ^ is the bitwise XOR operator. So when you write 10^9 , that gives the result as 3 since 10 xor 9 = 3. You are comparing the data not with 1000000000 but with 3.

Just remove this condition.

Also change the other if condition as well. Use < in it instead of >.