Read n numbers and determine the largest negative number

`#include <iostream> using namespace std; int main() { int i, n, a[100], neg=0, max; cin >> n; for(i=0;i<n;i++) { cin >> a[i]; if(a[i]<0) { neg++; } } if(neg==0) { cout << "No Negative numbers in the array"; } else { max = a[0]; for(i=0;i<n;i++) { if(a[i]<0) { if(a[i]>max) { max = a[i]; } } } cout << "Largest negative number is " << max; } return 0; }`