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
Show the declaration for a static member variable.
How a macro differs from a template?
What will happen if a pointer is deleted twice?
What is the this pointer?
What is conditions when using boolean operators?
What are arrays c++?
Write bites in Turbo c++ Header ("Include") Files.
Write a program to interchange 2 variables without using the third one.
What is the keyword auto for?
What is the use of cmath in c++?
What is the last index number in an array of 100 characters a) 100 b) 99 c) 101
What is a pointer how and when is it used?
Which function cannot be overloaded c++?
Should the member functions which are made public in the base class be hidden?
How would you obtain segment and offset addresses from a far address of a memory location?