KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am trying to create a program that will tell if a number given to it is a " Happy Number " or not. Finding a happy number requires each digit in the number to be squared, and the result of each digit's square to be added together. In Python, you could use something like this: SQUARE[d] for d in str(n) But I can't find how to iterate through each digit in a number in Java. As you can tell, I am new to it, and can't find an answer in the Java docs.
Tags (comma-separated)
Save Edits
Cancel