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

Why do we need templates?

1048


What are the benefits of pointers?

1106


Why is null pointer used?

1221


What is the use of default constructor?

1144


What are the benefits of oop in c++?

1315


Is python written in c or c++?

1201


Can you Mention some Application of C/C++?

1126


What size is allocated to the union variable?

1126


What is the full form of india?

1198


What language does google use?

1238


What is a constant? Explain with an example.

1079


What is the difference between #import and #include in c++?

1167


How do you decide which integer type to use?

1048


How to declaring variables in c++?

1206


What are iterators in c++?

1061