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 a progra in c++ using class & object to find out
wheather a given no. is prim or not.

Answer Posted / ***..$indhu..***

#include<iostream.h>
#include<conio.h>
class prime
{
int n,i;
public:
void giveno(int);
void no_prime();
};
void prime::giveno(int a)
{
n=a;
}
void prime::no_prime()
{
i=2;
if(i<=n-1)
{
if(n%i==0)
{
cout<<endl<<"not prime no";
else
cout<<endl<<"prime no";
break;
}
if(n==i)
{
cout<<endl<<"prime no";
}
}
}
int main()
{
prime p1;
p1.giveno(5);
p1.no_prime();
return 0;
}

Is This Answer Correct ?    33 Yes 10 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is inheritance in oop?

1092


Where You Can Use Interface in your Project

1939


What are the 4 pillars of oop?

1206


what is the drawback of classical methods in oops?

3431


How do you define social class?

1117


Can static class have constructor?

1086


What is abstraction in oops?

1097


i got a backdoor offer in process global,Bangalore..Can i work with it?

2894


write a program using c++ to implement single contiguous memory mangement techniques.display the content of the main memory after yhe allocation of jobs and percentage of the wastage of the main memory

3273


How to hide the base class functionality in Inheritance?

1190


Why do we use polymorphism?

1129


Whats oop mean?

1101


explain sub-type and sub class? atleast u have differ it into 4 points?

2364


What is the important feature of inheritance?

1189


How do you answer polymorphism?

1111