Failed test case 1 but i dont know the reason

failed in test case 1 . i dont know what is wrong in my code

if (i == N) {
   cout << "Prime" << endl;
}

this condition should be at starting of the loop

like this

#include<iostream>
using namespace std;
int main() {
    int i = 2;
    int N;
    cin >> N;
    while (i < N) {
        if (i == N) {
            cout << "Prime" << endl;
        }
        if (N % i == 0) {
            cout << "NOT Prime" << endl;
            break;
        }
        i = i + 1;
        
    }

    return 0;
}