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 the difference between #define debug 0 and #undef debug?
How long will it take to learn programming?
Is there a c++ certification?
Do you know what are static and dynamic type checking?
What is algorithm in c++ programming?
What are the uses of pointers?
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.
Why is c++ still popular?
Describe linkages and types of linkages?
What is #include math h in c++?
Which format specifier is used for printing a pointer value?
Define a nested class. Explain how it can be useful.
Is turbo c++ free?
write a corrected statement so that the instruction will work properly. if (4 < x < 11) y = 2 * x;
How did c++ start?