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
When are exception objects created?
What is c++ runtime?
What is c++ stringstream?
What is operator overloading in c++ example?
Write a program using display() function which takes two arguments.
What are the important differences between c++ and java?
Why is main function important?
What are the uses of typedef in a program?
How to demonstrate the use of a variable?
Can manipulators fall in love?
Is empty stack c++?
How would you call C functions from C++ and vice versa?
What is an inclusion guard?
Is python written in c or c++?
Is java made in c++?