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
How does java differ from c and c++?
What is time h in c++?
What are the different types of comments allowed in c++?
What does it mean to declare a member variable as static?
What do you mean by public protected and private in c++?
What is the difference between a reference and a pointer?
Can I make ios apps with c++?
Can there be at least some solution to determine the number of arguments passed to a variable argument list function?
Is c++ still in demand?
Do you know the problem with overriding functions?
Is python written in c or c++?
Is it possible to provide special behavior for one instance of a template but not for other instances?
What is c++ flowchart?
Write a program to find the Factorial of a number
What do you mean by early binding?