Answer Posted / rajan maheshwari
#include<iostream.h>
#include<conio.h>
void main()
{clrscr();
int a,c=0,i=2;
cout<<"Enter A Number = ";
cin>>a;
while(i<=a/2)
{
if(a%i==0)
{c=0;
break;}
else
{i++;
c=1;
}}
if(c==1||a==2||a==3)
cout<<"\nPrime Number";
else
if(a==1)
cout<<"\nNeither Prime Nor Composite";
else
cout<<"\nNot a Prime Number";
getch();
}
| Is This Answer Correct ? | 3 Yes | 0 No |
Post New Answer View All Answers
What is a .lib file in c++?
Is java based off c++?
Is dev c++ free?
How can you quickly find the number of elements stored in a dynamic array?
What is a singleton class c++?
Explain what data encapsulation is in c++?
Why c++ is faster than java?
what does the following statement mean? int (*a)[4]
What is ios :: in in c++?
How much do coding jobs pay?
Why is c++ still popular?
Write a program to find the Fibonacci series recursively.
Explain terminate() and unexpected() function?
What is the difference between reference and pointer?
Differentiate between a copy constructor and an overloaded assignment operator.