Answer Posted / swapnil
/*To check whethere Entered no. is PRIME or NOT*/
#include<iostream.h>
#include<conio.h>
main()
{
int num,i;
clrscr();
cout<<"Enter the any no.="<<"\n";
cin>>num;
for(i=2;i<=num;i++)
{
if(num%i==0)
{
break;
}
}
if(i==num)
{
cout<<"The number entered is a
PRIME no.";
}
else
{
cout<<"The number entered is NOT a
PRIME no.";
}
getch();
}
| Is This Answer Correct ? | 74 Yes | 41 No |
Post New Answer View All Answers
Why the usage of pointers in C++ is not recommended ?
What is a storage class used in c++?
Write a program using display() function which takes two arguments.
In a function declaration, what does extern mean?
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)
What is std namespace in c++?
What is set in c++?
How the programmer of a class should decide whether to declare member function or a friend function?
Explain the concept of copy constructor?
What is a class template?
Explain the uses of static class data?
Is it possible to pass an object of the same class in place of object reference to the copy constructor?
Are there any special rules about inlining?
Can a program run without main in c++?
What are the various oops concepts in c++?