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 c++ and its uses?
Draw a flow chart and write a program for the difference between the sum of elements with odd and even numbers. Two dimensional array.
What is the default access level?
Write about the various sections of the executable image?
What is the header file for setw?
How can you quickly find the number of elements stored in a static array? Why is it difficult to store linked list in an array?
What is a multiset c++?
what are the characteristics of Class Members in C++?
Why do we use structure in c++?
What are the comments in c++?
What is split a string in c++?
What is the default width for ouputting a long integer using the insertion operator?
What is a breakpoint?
Does std endl flush?
Will c++ be replaced?