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 do we need templates?
What are the benefits of pointers?
Why is null pointer used?
What is the use of default constructor?
What are the benefits of oop in c++?
Is python written in c or c++?
Can you Mention some Application of C/C++?
What size is allocated to the union variable?
What is the full form of india?
What language does google use?
What is a constant? Explain with an example.
What is the difference between #import and #include in c++?
How do you decide which integer type to use?
How to declaring variables in c++?
What are iterators in c++?