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
How to declare a function pointer?
How do we implement inheritance in c++?
What are the two types of polymorphism?
What is exception handling? Does c++ support exception handling?
What is class invariant in c++?
What is :: operator in c++?
What is isdigit c++?
Explain virtual destructor?
What is the best way to take screenshots of a window with c++ in windows?
What is the c++ code?
Is c++ used anymore?
What is searching? Explain linear and binary search.
What are the differences between java and c++?
How do you clear a buffer in c++?
If dog is a friend of boy, is boy a friend of dog?