Answer Posted / suresh kumar
#include<iostream.h>
#include<conio.h>
void main()
{
int n,k,i=1;
cout<<"enter any no to check prime";
cin>>n;
for(i=2;i<n;i++)
{
if(n%i==0)
k=2;
}
if(k==2)
cout<<"the no is not prime"<<endl;
else
cout<<"the no is prime";
getch();
}
Is This Answer Correct ? | 4 Yes | 1 No |
Post New Answer View All Answers
How to give an alternate name to a namespace?
Explain what you mean by a pointer.
What is the keyword auto for?
If all is successful, what should main return a) 0 b) 1 c) void
When does a 'this' pointer get created?
Can the creation of operator** is allowed to perform the to-the-power-of operations?
In int main(int argc, char *argv[]) what is argv[0] a) The first argument passed into the program b) The program name c) You can't define main like that
What will the line of code below print out and why?
Why is c++ a mid-level programming language?
Why is c++ still used?
We all know that a const variable needs to be initialized at the time of declaration. Then how come the program given below runs properly even when we have not initialized p?
Why #include is used?
What are the uses of c++ in the real world?
What is the use of main function in c++?
Define pre-condition and post-condition to a member function in c++?