InterviewSolution
Saved Bookmarks
| 1. |
Write a javascript program to enter a number and then print its digits |
|
Answer» "Starting with any positive integer, replace the number by the sum of the squares of its digits, and REPEAT the PROCESS until the number equals 1 (where it will STAY), or it loops endlessly in a cycle which does not INCLUDE 1. Those numbers for which this process ends in 1 are HAPPY numbers, while those that do not end in 1 are unhappy numbers (or sad numbers)". |
|