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
What is a friend function in c++?
What are c++ data types?
What is c++ & why it is used?
Can we overload operator in c++?
Why do we use the using declaration?
What is a NULL Macro? What is the difference between a NULL Pointer and a NULL Macro?
Why should you learn c++?
I want explanation for this assignment: how to connect mysql database using c/c++,please explain this detailly?
How can I improve my c++ skills?
What is pointer to member?
What is binary object model?
What is the difference between ++ count and count ++?
What are the characteristics of friend functions?
Implement stack operations with pointers with appropriate exception checks.
Difference between overloading vs. Overriding