This is a program to find whether the entered number is a prime number or not. There is no errors but i always get the the answer as not a prime number for any number.
#include<iostream.h>
#include<conio.h>
void main()
{ clrscr();
int n,count = 0,i;
cout<<"enter the number n";
cin>>n;
for(i=1;i<=n;i++){
if(n%i==0)
count++;
}
if(count==2){
cout<<"It is a prime number";}
else {
cout<<"It is not a prime number";}
getch();
}