Answer Posted / daljeet singh
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int n,i;
char prime;
prime='Y';
cout<<"\n enter a number";
cin>>n;
for(i=2;i<=n/2;++i)
{
if(n%i==0)
{
prime='N';
break;
}
}
if(n==1)
prime='N';
if(prime=='Y')
cout<<"\n entered number is prime";
else
cout<<"\n not a prime no";
getch();
}
| Is This Answer Correct ? | 10 Yes | 3 No |
Post New Answer View All Answers
What are the advantages of using a pointer? Define the operators that can be used with a pointer.
What is the difference between an array and a list?
Explain selection sorting?
What is the main purpose of overloading operators?
write a function signature with various number of parameters.
What is the difference between *p++ and (*p)++ ?
You want to link a c++ program to c functions. How would you do it?
What does new do in c++?
Which is not a valid keyword a) public b) protected c) guarded
What does 7/9*9 equal ? a) 1 b) 0.08642 c) 0
What is guard code in c++?
What is function prototyping? What are its advantages?
What is data type in c++?
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?
What is the difference between #define debug 0 and #undef debug?