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 global variables and local variable
Do vectors start at 0?
What is the use of structure in c++?
What is rvalue?
What is the type of 'this' pointer?
Write a note about the virtual member function?
What is the difference between an enumeration and a set of pre-processor # defines?
Where the memory to the static variables is allocated?
Do you need a main function in c++?
Explain the static member function.
What is a map in c++?
What are mutator methods in c++?
What do you mean by public protected and private in c++?
What is the cout in c++?
What's the best free c++ profiler for windows?