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
Can you overload the operator+ for short integers?
What's the most powerful programming language?
Can I create my own functions in c++?
Describe the advantages of operator overloading?
What do nonglobal variables default to a) auto b) register c) static
Write a program to find the reverse Fibonacci series starting from N.
write a program that withdrawals,deposits,balance check,shows mini statement. (using functions,pointers and arrays)
To what does “event-driven” refer?
What is #include math h in c++?
What are the benefits of operator overloading?
Write about the use of the virtual destructor?
What is auto type c++?
what is C++ exceptional handling?
What are manipulators in c++ with example?
Can we specify variable field width in a scanf() format string? If possible how?