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 is general format for a prototype?
Explain the uses of static class data?
How should runtime errors be handled in c++?
What is a singleton class c++?
Is c++ slower than c?
When there is a global variable and local variable with the same name, how will you access the global variable?
Why do we need constructors in c++?
Difference between a homogeneous and a heterogeneous container
Why is c++ called oops?
Is arr and &arr are same expression for an array?
Does improper inheritance have a potential to wreck a project?
What is the need of a destructor?
What are the differences between malloc() and calloc()?
Is c++ the hardest language?
Why is c++ awesome?