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
Difference between a homogeneous and a heterogeneous container
What is runtime polymorphism in c++?
Difference between pass by value and pass by reference?
Write a program to add three numbers in C++ utilizing classes.
what is the difference between linear list linked representaion and linked representation? what is the purpose of representing the linear list in linked represention ? is it not avoiding rules of linear represention?
How do I exit turbo c++?
What is null pointer and void pointer and what is their use?
What is the correct syntax for inheritance a) class aclass : public superclass b) class aclass inherit superclass c) class aclass <-superclass
What is abstraction in c++ with example?
What is an object in c++?
Show the declaration for a static member variable.
How is data hiding achieved in c++?
What is c++ array?
Why is it necessary to use a reference in the argument to the copy constructor?
How much do c++ programmers make?