Answer Posted / prits
#include <iostream>
using namespace std;
void main()
{
int num;
int flag = 0;
cout<<"enter a number"<<endl;
cin>>num;
for(int i=2;i<num;i++)
{
if((num%i) == 0)
{
flag = 1;
break;
}
}
if (flag == 1)
cout<<"Not Prime"<<endl;
else
cout<<"Prime"<<endl;
}
Is This Answer Correct ? | 32 Yes | 15 No |
Post New Answer View All Answers
What do you understand by zombie objects in c++?
What is pointer to array in c++?
What are advantages of using friend classes?
Which is best c++ or java?
What is abstract class in c++?
What is operator overloading in c++ example?
total amount of milk produced each morning and then calculates and outputs the number of cartons needed for this milk , the cost of producing the milk and the profit from producing this milk.
What is :: operator in c++?
What are static type checking?
What is the use of ::(scope resolution operator)?
Which is best ide for c++?
Can I make ios apps with c++?
Why do we use classes in programming?
Which header file allows file i/o with streams a) fileio.h b) iostream.h c) fstream.h
When is dynamic checking necessary?