Question: Needs to be in C program 2 Narcissistic Numbers A number is called Narcissistic is a number that is the sum of its own digits
2 Narcissistic Numbers A number is called Narcissistic is a number that is the sum of its own digits each raised to the power of the number of digits. For example 153 is narcissistic because 18 +58 +39 = 1 + 125+ 27 = 153. 1. Develop a C function called isNarcissistic that receives us input an int n and returns true if n is a narcissistic and fulse otherwise. Use the following function prototype: bool inNarcissistic(int num, int len); 2. Write a main function that asks the user to enter the number of digits n (up to 5 digits) that the user wants to search for and prints all Narcissistie numbers with n digits. Ensure that you use the isNarcissistic function in the main. Sample Code Execution 1: Red text indicates information entered by the user Enter the number of digits: 7 You are only allowed to search up to 5 digits Enter the number of digits: 1 Narcissistic numbers: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, Sample Code Execution 2: Enter the number of digits:2 Narcissistic numbers: Sample Code Execution 3: Enter the number of digits:3 Narcissistic numbers: 153, 370, 371, 407, Sample Code Execution 4: Enter the number of digits:4 Narcissistic numbers: 1634, 8208, 9474, Sample Code Execution 5: Enter the number of digits: 5 Narcissistic numbers: 54748, 92727, 93084
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
