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
Discussion on error handling of C++ .
What are pointers used for c++?
Differentiate between structure and class in c++.
How do you import payscale data from non SAP to SAP?is it through LSMW or any other way is there?
What is the best free c++ compiler for windows?
What are the five basic elements of a c++ program?
What are the c++ access specifiers?
Which one is better- macro or function?
What is the hardest coding language to learn?
What are the benefits of operator overloading?
What does floor mean in c++?
What are the two shift operators and what are their functions?
Why do we use pointers in c++?
What does getch() do according to the ANSI C++ standard a) Reads in a character b) Checks the keyboard buffer c) Nothing in particular (Its not defined there)
Can the creation of operator** is allowed to perform the to-the-power-of operations?