Create a function file called narcissisticNumbers.m.
Using for loop(s) or while loop(s), write a function narcissisticNumbers that returns all the narcissistic
numbers between 300 and 399 (there should be two).
a number n is called narcissistic if it satisfies the condition
n = dk
k + dk-1
k + ... + d2
k + d1
k.
For example the 3-digit decimal number 153 is a narcissistic number because 153 = 13 + 53 + 33
Hint: 1) use a nested loop for all possible combinations of digits, or 2) use mod and fix/floor
functions.
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
Finding a professional expert in "partial differential equations" in the advanced level is difficult.
You can find this expert in "Assignmentexpert.com" with confidence.
Exceptional experts! I appreciate your help. God bless you!
Comments
Leave a comment