Question: We define a complete number as a number whose digits' sum equals to the digits' product. For example, 123 is a complete number since
We define a complete number as a number whose digits' sum equals to the digits' product. For example, 123 is a complete number since 1+2+3 = 6 = 1*2*3, while 124 is not a complete number since 1+2+4=7 #8 = 1*2*4. Write a function main() which uses the following three functions to read a positive integer and print whether the integer is a complete number or not. int getInput(); integer N void digitize(); stores its digits in an array A[] bool is Complete(); calls digitize(), returns true if N is complete //reads and returns a positive // takes a positive integer N, // takes a positive integer N, // complete, and returns false if N is not Sample input/ output: Enter a positive integer: 123 positive integer: 124 The number 123 is complete number 124 is not complete
Step by Step Solution
3.50 Rating (150 Votes )
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
