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 Difeerence between List obj=new ArrayList(); and ArrayList obj=new ArrayList()?

2526


Write a program to compute for numeric grades for a course. The course records are in a file that will serve as the input file. The input file is in exactly the following format: Each line contains a student's first name, then one space, then ten quiz scores all on one line. The quiz scores are in whole number and are separated by one space. Your program will take it input from this file and sends it output to a second file. The data in the output file will be exactly the same as the data in the input file except that there will be one additional number (of type double) at the end of each line. This number will be the average of the student's ten quiz scores. Use at least one function that has file streams as all or some of its arguments.

3077


What does oop mean in snapchat?

1229


What is oops concept with example?

1011


Why do we use inheritance?

1111


write a programe to calculate the simple intrest and compund intrest using by function overlading

2193


What is cohesion in oop?

1051


What is inheritance in oop?

1032


How Do you Code Composition and Aggregation in C++ ?

25447


what are the different types of qualifier in java?

2266


What is coupling in oops?

1139


What is super in oop?

1169


What is the difference between a constructor and a destructor?

1252


Plese get me a perfect C++ program for railway/airway reservation with all details.

3893


if i have same function with same number of argument but defined in different files. Now i am adding these two files in a third file and calling this function . which will get called and wht decide the precedence?

3508