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
Using a smart pointer can we iterate through a container?
What is one dimensional array in c++?
How do you add an element to a set in c++?
How did c++ get its name?
Explain what is polymorphism in c++?
What is the difference between public, private, and protected access?
What do you mean by friend class & friend function in c++?
What is microsoft c++ redistributable 2013?
What is a namespace in c++?
How is new() different from malloc()?
What is the meaning of string in c++?
How do you remove an element from a set in c++?
What is basic if statement syntax?
Mention the purpose of istream class?
What is the type of this pointer in c++?