Design a class Pronic to check if a given number is a pronic number or not. [ A number is said to be pronic if the product of two consecutive numbers is equal to the number]
  Example: 0 = 0 × 1
  2 = 1 × 2
  6 = 2 × 3
  12 = 3 × 4    
  thus, 0, 2, 6, 12... are pronic numbers.
  Some of the members of the class are given below
  Class name : Pronic
  Data members/instance variables:
  num : to store a positive integer number
  Methods / Member functions:
  Pronic( ) : default constructor to initialize the data member with legal initial value
  void acceptnum( ) : to accept a positive integer number
  boolean ispronic(int v) : returns true if the number ‘num’ is a pronic number, otherwise returns false using recursive technique
  void check( ) : checks whether the given number is a pronic number by invoking the function ispronic() and displays the result with an appropriate message
  Specify the class Pronic giving details of the constructor( ), void acceptnum( ),
  boolean ispronic(int) and void check( ). Define a main( ) function to create an object and call the functions accordingly to enable the task
        
Solution:
,,
 
undefined                                                                  


                                            



Contact Us

REACH US

SERVICES

  • CODING
  • ON-LINE PREPARATION
  • JAVA & PYTHON

ADDRESS

B-54, Krishna Bhawan, Parag Narain Road, Near Butler Palace Colony Lucknow
Contact:+ 919839520987
Email:info@alexsir.com