Page 1 of 1

C++ Narcissistic Number Implement a C++ program to tell whether the input string consisting three characters from a comm

Posted: Mon May 09, 2022 7:07 am
by answerhappygod
C++ Narcissistic Number
Implement a C++ program to tell whether the input string
consisting three characters from a command line user is a
narcissistic number or not. The program should use a variable of
string type to accept the input from a user. Suppose the user
inputs are always valid. So, the program doesn't need to consider
input validation.
The command line program should look like this:
Example 1:
Please input a 3-digit integer:153
153 is a narcissistic number.
Example 2:
Please input a 3-digit integer: 999
999 is not a narcissistic number.
Requirements: The program cannot use any
loop in the solution. The program cannot also involve any
division operation (e.g. using “/”) in the solution. Avoid using
advanced syntax.