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
"assignmentexpert.com" is professional group of people in Math subjects! They did assignments in very high level of mathematical modelling in the best quality. Thanks a lot
Comments
Leave a comment