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 an iterator?
What is the use of cmath in c++?
How we can differentiate between a pre and post increment operators during overloading?
Is it possible to provide special behavior for one instance of a template but not for other instances?
What is the extension of c++?
What is an inline function in c++?
How can we read/write Structures from/to data files?
Which software is best for coding?
Write about the members that a derived class can add?
What is the c++ code?
Define 'std'.
What is the best c c++ compiler for windows?
Write my own zero-argument manipulator that should work same as hex?
Write a note about the virtual member function?
Can we make copy constructor private in c++?