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.
Friday, 27 July 2012
how to find prime number using c++
This is the source code for finding prime number
#include<iostream.h>
#include<conio.h>
main()
{
int n,d,p=1;
cout<<"enter the number?";
cin>>n;
d=2;
while(d<=n/2)
{
if(n%d==0)
p=0;
d++;
}
if(p==0)
cout<<"not prime number";
else
cout<<"prime number";
getch();
}
End
Subscribe to:
Post Comments (Atom)
thank you for sharing nice article in your blog
ReplyDeletevisit
web tutorial programming
welookups