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 / md.irfan(rourkela)

#include<iostream.h>
#include<conio.h>
main()
{
int n,i,f=1;
cout<<"enter any no to check prime";
cin>>n;
for(i=2;i<n;i++)
{
if(n%i==0)
k=2;
}
if(k==2)
cout<<"the no is not prime"<<endl;
else
cout<<"the no is prime";
}
getch();
}

Is This Answer Correct ?    145 Yes 91 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain explicit container.

1032


an operation between an integer and real always yeilds a) integer result b) real result c) float result

1105


How are pointers type-cast?

1057


Why do we need constructors in c++?

1056


Can a program run without main?

1155


How do c++ struct differs from the c++ class?

1118


How does atoi function work?

1099


What is time h in c++?

1076


What is static class data?

986


What is the difference between multiple and multilevel inheritance in c++?

1080


What is implicit pointer in c++?

1028


What are the storage qualifiers?

1101


What will the line of code below print out and why?

675


What is a c++ object?

1096


What is the copy-and-swap idiom?

1042