1.

Question1. Design a class PrimePalinGen to generate prime palindrome numbers. [ A number is said to be prime palindrome if the number is a prime as well as a palindrome number ] [ Prime number: A number having only two factors i.e. 1 and itself ] [ Palindrome number: A number which is same as its reverse ] Example: 11(where 11 is a prime number and a palindrome number) Some of the members of the class are given below: [10] Class name : PrimePalinGen Data members/instance variables: start : to store the start of range end : to store the end of range Methods/Member functions: PrimePalinGen (int a, int b) : parameterized constructor to initialize the data members start=a and end=b int isPrime(int i) : returns 1 if the number is prime otherwise returns 0 int isPalin(int i) : returns 1 if the number is a palindrome otherwise returns 0 void generate( ) : generates all prime palindrome numbers between start and end by invoking the functions isPrime() and isPalin(). Specify the class PrimePalinGen giving details of the constructor( ),int isPrime(int), int isPalin(int) and void generate( ). Define a main( ) function to create an object and call the functions accordingly

Answer» ONG>Explanation:

Find the value of m so that the QUADRATIC equation px^2 + (p – 1) x +(p – 1) = 0 has equal roots.



Discussion

No Comment Found