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 is general form of pure virtual function? Explain?
What is a template in c++?
How java is different from c and c++?
What is #include c++?
What is an arraylist c++?
What is iostream in c++ used for?
What is an adaptor class in c++?
Is turbo c++ free?
What are protected members in c++?
In what situations do you have to use initialization list rather than assignment in constructors?
What is flush programming?
Explain abstraction.
What are the five basic elements of a c++ program?
What are guid? Why does com need guids?
Explain 'this' pointer and what would happen if a pointer is deleted twice?