Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

write the prime no program in c++?

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


Please Help Members By Posting Answers For Below Questions

Using a smart pointer can we iterate through a container?

1026


What is one dimensional array in c++?

1044


How do you add an element to a set in c++?

935


How did c++ get its name?

982


Explain what is polymorphism in c++?

1087


What is the difference between public, private, and protected access?

1013


What do you mean by friend class & friend function in c++?

1014


What is microsoft c++ redistributable 2013?

1041


What is a namespace in c++?

1919


How is new() different from malloc()?

1067


What is the meaning of string in c++?

1013


How do you remove an element from a set in c++?

1032


What is basic if statement syntax?

1015


Mention the purpose of istream class?

1063


What is the type of this pointer in c++?

1015