Answer Posted / adnan sheikh
#include<iostream.h>
#include<conio.h>
main()
{
int i,j,num;
cout<<"enter nay number";
cin>>num;
j=static_cast<int>(num/2);
for(int i=2;i<=j;i++)
{
if(!(num%i))
break;
}
if(i==(j+1))
cout<<"number is prime";
else
cout<<"number is not prime";
getch();
}
| Is This Answer Correct ? | 8 Yes | 19 No |
Post New Answer View All Answers
Which is most difficult programming language?
What is the role of C++ shorthand's?
Explain what is polymorphism in c++?
What is while loops?
When do you call copy constructors?
What is endianness?
What are the effects after calling the delete this operator ?
When do we run a shell in the unix system?
Why is c++ a mid-level programming language?
What is meant by const_cast?
Is atoi safe?
What is the role of static keyword for a class member variable?
Why is main function important?
What is the best c++ book for beginners?
Can non-public members of another instance of the class be retrieved by the method of the same class?