Prime or not

Description:

Write a C++ class called prime with Data members: Number integer, The program should ask for one integer number, and function check if it is prime or not Test Case 1 Input (stdin) 7 Expected Output Prime number Test Case 2 Input (stdin) 14 Expected Output Not a prime number

Program :

#include <iostream>  


using namespace std;  


int main()  


{  


  int n, i, m=0, flag=0;  


 // cout << "Enter the Number to check Prime: ";  


  cin >> n;  


  m=n/2;  


  for(i = 2; i <= m; i++)  


  {  


      if(n % i == 0)  


      {  


          cout<<"Not a prime number"<<endl;  


          flag=1;  


          break;  


      }  


  }  


  if (flag==0)  


      cout << "Prime number"<<endl;  


  return 0;  


}