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
When does the c++ compiler create temporary variables?
What is the role of copy constructor in copying of thrown objects?
Differentiate between declaration and definition.
What are the general quetions are in DEna bank manager IT/System interviews?
Where Malloc(), Calloc(), and realloc() does get memory?
What is the main purpose of c++?
What is a list c++?
Write a short code using c++ to print out all odd number from 1 to 100 using a for loop
Is atoi safe?
Why Pointers are not used in C++?
Explain the difference between using macro and inline functions?
What is the difference between strcpy() and strncpy()?
What is the latest c++ version?
Explain rtti.
What is the use of bit fields in structure declaration?