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
Differentiate between realloc() and free().
What should main() return in c and c++?
When do we run a shell in the unix system? How will you tell which shell you are running?
What does int * mean in c++?
What are member functions used in c++?
What is runtime polymorphism in c++?
What are pointer-to-members in C++? Give their syntax.
How do you flush std cout?
Can we inherit constructor in c++?
What are the various storage classes in C++?
What is private inheritance?
What is function prototyping?
What is a namespace in c++?
Write a single instruction that will store an EVEN random integer between 54 and 212 inclusive in the variable myran. (NOTE only generate EVEN random numbers)
Is c++ double?