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
Which operator cannot overload?
What is problem with overriding functions?
What is the equivalent of Pascal's Real a) unsigned int b) float c) char
What are the advantage of using register variables?
Why is null pointer used?
How is c++ different from java?
How would you use the functions sin(), pow(), sqrt()?
What is one dimensional array in c++?
How do you declare A pointer to a function which receives nothing and returns nothing
What are multiple inheritances (virtual inheritance)?
Can you please explain the difference between using macro and inline functions?
What is prototype in c++ with example?
Which function should be used to free the memory allocated by calloc()?
What is name hiding in c++?
program explaining feautures of c++