C++ Programming exercise with solution : find the number which has the largest number of divisor

Exercise:

Find the number between 0 to 1000 that has the largest number of divisors and show how many divisor does it has.

Result:
x is the number that has the largest number of divisors.
It has x divisors.

Solution:
#include<iostream>
using namespace std;

 int numberDivisor(int a) {
  int number = 0;
  for (int i = 1; i < a + 1; i++) {
   if (a % i == 0)
    number++;
  }
  return number;
 }

int main(void){

  int maxDivisor = 0;
  int n = 0;

  for (int i = 1; i < 1001; i++) {
   if (maxDivisor < numberDivisor(i)) {
    maxDivisor = numberDivisor(i);
    n = i;
   }
  }

  cout<<n<< " is the number that has the largest number of divisors"<<endl;
  cout<<"It has " <<numberDivisor(n) << " divisors."<<endl;

}

Try hard we will success. :)