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
List the issue that the auto_ptr object handles?
What programming language should I learn first?
What is the limitation of cin while taking input for character array?
Which one is better- macro or function?
What is a binary file? List the merits and demerits of the binary file usagein C++.
What are manipulators in c++ with example?
Should I learn c++ c?
Can you please explain the difference between static and dynamic binding of functions?
What are inline functions? What is the syntax for defining an inline function?
write a corrected statement in c++ so that the statement will work properly. x = y = z + 3a;
What is the arrow operator in c++?
What is a constant reference?
What is polymorphism & list its types in c++?
What is the difference between global int and static int declaration?
Is swift faster than go?