i have to write a program that says whether the number i enter is Naracissistic or not.
i wrote the codes and everything but every time i write 153 or 24678051 it says its not a Naracissistic number :( plz tell me whats wrong with the codes i wrote :(
One thing that's apparent is that you don't use the argument which is passed into your isNarcissistic() function at all. Instead of declaring a num1 variable, just use num. Edit: Also, you're dividing by 100 all the time, which is moving the decimal place two places to the left. You should probably be dividing by 10 instead.
I messed around with your code, and my "correct" implementation ended up being very similar with a few more tweaks besides the ones I already mentioned, so you should be able to figure it out from here.
Your isNarcissistic() function never uses the value which is passed to it. Your function declaration has int num in it, but you never use it or assign it to anything. You just have this uninitialized variable called num1 all over the place. Try this first: