The logic should be:
while(n!=0)
(
b=n%10;
a=a+Math.pow(b,3);
n=n/10;
)
Sorry I don't have flowerbrackets on my keyboard so used round brackets for encapsulating the block.
This is my 9th grade problem so I still remember. This will work. And good to see a person with so much interest to learn programming. You can ask me questions related to programming whenever you want. All the best buddy. It will work.