Tuesday, 17 March 2015

How To Find Prime Number in C++ which is enter by user

  How To Find Prime Number in C++   it is the Simple program which will find the prime number in the first 100 number which is en... thumbnail 1 summary

  How To Find Prime Number in C++

 

it is the Simple program which will find the prime number in the first 100 number which is entered by the user you can increase its range by include the 11 13 and 17 and so on to the condition of if statement.
#include<istream.h>
int main()
{
int a;
cout<<"Program that Find Prime Number in first 100 numbers"<<endl;
cout<<"please enter the number for 1 to 100"<<endl;
cin>>a;
if(a%2!=0&&a%3!=0&&a%5!=0&&a%7!=0||a==1||a==2||a==3||a==5||a==7)
{
cout<<"Prime Number"<<endl;
}
else
cout<<"Not Prime Number"<<endl;
system("Pause");
return 0;
};