Answer Posted / suresh kumar
#include<iostream.h>
#include<conio.h>
void main()
{
int n,k,i=1;
cout<<"enter any no to check prime";
cin>>n;
for(i=2;i<n;i++)
{
if(n%i==0)
k=2;
}
if(k==2)
cout<<"the no is not prime"<<endl;
else
cout<<"the no is prime";
getch();
}
| Is This Answer Correct ? | 4 Yes | 1 No |
Post New Answer View All Answers
Do class method definitions?
What does it mean to declare a member function as static?
Why c++ is so important?
Is it possible to provide special behavior for one instance of a template but not for other instances?
Are c and c++ different?
Can I uninstall microsoft c++ redistributable?
A mXn matrix is given and rows and column are sorted as shown below.Write a function that search a desired entered no in the matrix .with minimum complexity 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
What are friend classes?
Explain function overloading and operator overloading.
How do I use turbo c++?
What is the basic structure of c++ program?
What do the header files usually contains?
Why do we use double in c++?
What is the difference between structures and unions?
What are member functions used in c++?