PRASHNIKAप्रश्निका
‹ Back to the paper

A Special number is a number in which the sum of the factorial of its digits is equal to the…

Computer Science202010 marksProgram
A Special number is a number in which the sum of the factorial of its digits is equal to the number. Example: 145 ($1! + 4! + 5! = 145$). Thus, 145 is a Special number. Design a class Special to check if the given number is a Special number or not. Some of the members of the class are given below: Class name : Special Data member/instance variable: n : integer to store number Member functions/methods: Special() : default constructor void read() : to accept the number int factorial(int x) : return the factorial of a number using recursive technique boolean isSpecial() : checks for the special number by invoking the function factorial() and returns true if Special, otherwise returns false void display() : displays the result with an appropriate message Specify the class Special, giving details of the Constructor, void read(), int factorial(int), boolean isSpecial() and void display(). Define the main() function to create an object and call the member function according to enable the task.

Answer

No answer yet.

Objects

From ISC 2020 Specimen Computer Science Paper 1, question 9.