Prime o no en CPP

// prime or not

#include <iostream>
using namespace std;

int main()
{
    int num, i, counter = 0;

    cout<< "Enter the number : ";
    cin>> num;

    for(i=2; i<num; i++)
    {
        if (num % i == 0)
            counter ++;
    }

    if(counter != 0)
        cout<< "Composite";
    else
        cout<< "Prime";

    return 0;
}
Sleep deprived