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 mean by vtable and vptr in c++?
Differentiate between late binding and early binding. What are the advantages of early binding?
Define Virtual function in C++.
What is tellg () in c++?
What problems might the following macro bring to the application?
If horse and bird inherit virtual public from animal, do their constructors initialize the animal constructor? If pegasus inherits from both horse and bird, how does it initialize animal’s constructor?
What is the main purpose of overloading operators?
What is a vector c++?
Comment on assignment operator in c++.
Why do we use constructor?
Which operator cannot overload?
What are friend classes? What are advantages of using friend classes?
What is virtual destructor ans explain its use?
what is Member Functions in Classes?
Explain what are mutator methods in c++?