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
Does c++ have foreach?
What is singleton class in c++?
What are the various oops concepts in c++?
the first character in the variable name must be an a) special symbol b) number c) alphabet
Describe friend function & its advantages.
What is pure virtual function?
Discuss the effects occur, after an exception thrown by a member function is unspecified by an exception specification?
Are vectors faster than arrays?
the maximum length of a character constant can be a) 2 b) 1 c) 8
what is oops and list its features in c++?
What is array in c++ pdf?
Tell me can a pure virtual function have an implementation?
Which of the following is not a valid declaration for main() a) int main() b) int main(int argc, char *argv[]) c) They both work
How many namespaces are there in c++?
which operator is used for performing an exponential operation a) > b) ^ c) none