It always show min as -1 and max value in array correct. what is wrong with min.
code:
#include
#include
using namespace std;
int main()
{
int N,i;
cin>>N;
int a[N];
for(i=0;i<N;i++)
{
cin>>a[i];
}
int aMax=LLONG_MIN;
int aMin=LLONG_MAX;
for(i=0;i<N;i++)
{
if(a[i]<aMin)
aMin=a[i];
if(a[i]>aMax)
aMax=a[i];
}
cout<<aMin<<’ '<<aMax<<endl;
return 0;
}