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
Describe exception handling concept with an example?
What is enum c++?
What is rtti in c++?
Explain linked list using c++ with an example?
Is there a sort function in c++?
What is the difference between while and do while loop?
What is the use of setprecision in c++?
What does std :: flush do?
How do I download c++?
What is a wchar_t in c++?
Which is the best c++ compiler?
Tell me can a pure virtual function have an implementation?
What are guid? Why does com need guids?
Define the operators that can be used with a pointer.
Will c++ be replaced?