Answer Posted / md.irfan(rourkela)
#include<iostream.h>
#include<conio.h>
main()
{
int n,i,f=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 ? | 145 Yes | 91 No |
Post New Answer View All Answers
What does scope resolution operator do?
What are disadvantages of pointers?
What do you mean by function pointer?
Why was c++ created?
Can member functions be private?
What is difference between array and vector in c++?
What are protected members in c++?
What character terminates all character array strings a) b) . c) END
What is the difference between a definition and a declaration?
What is difference between c++ 11 and c++ 14?
How can you specify a class in C++?
Why c++ is so important?
Write about the role of c++ in the tradeoff of safety vs. Usability?
What is array give example?
When the constructor of a base class calls a virtual function, why doesn't the override function of the derived class gets called?