we provide you the c downloads,c programing,c tutorials and much more at www.cplusplus-in.blogspot.com.Codes of c++ are also there for your help.This blog build your c programing style.
Tuesday, 16 October 2012
Saturday, 13 October 2012
how to find the prime number using c++(with simple coding)
how to find prime number in c++:
This is the source code for determining that given number is prime or not
#include<iostream.h>
#include<conio.h>
main()
{
int x;
for(int i=1;i<=100;i++){
cout<<"enter the number"<<endl;
cin>>x;
if(x==2 || x==3 || x==5){
cout<<"number is prime"<<endl;
}
else if(x%2==0 || x%3==0 || x%5==0)
{
cout<<"not prime"<<endl;
}
else
{
cout<<"number is prime"<<endl;
}
}
getch();
}
End
Subscribe to:
Posts (Atom)