subject

Start with any positive integer, replace the number by the sum of the squares of its digits in base-ten, and repeat the process until the number either equals 1 (where it will stay), or it loops endlessly in a cycle that include number 4. Those numbers for which this process ends in 1 are called happy numbers, others are unhappy or sad numbers.
Examples:
208 -> 2*2 + 8*8 = 68 -> 6*6 + 8*8 = 100 -> 1*1 = 1 ---> HAPPY NUMBER :)
145 -> 1*1 + 4*4 + 5*5 = 42 -> 4*4 + 2*2 = 20 -> 2*2 = 4 ---> SAD NUMBER :(

Write a program that gets a number and says if it is happy or not.

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 19:10
What a backup plan that you have created in a event you encounter a situation
Answers: 2
question
Computers and Technology, 23.06.2019 14:30
Open this link after reading about ana's situation. complete each sentence using the drop-downs. ana would need a minimum of ato work as a translator. according to job outlook information, the number of jobs for translators willin the future.
Answers: 3
question
Computers and Technology, 24.06.2019 07:00
You are most likely to automatically encode information about
Answers: 1
question
Computers and Technology, 24.06.2019 11:00
In three to five sentences, describe how you can organize written information logically and sequentially
Answers: 1
You know the right answer?
Start with any positive integer, replace the number by the sum of the squares of its digits in base-...
Questions
question
Mathematics, 11.03.2022 04:00
question
Mathematics, 11.03.2022 04:00
question
English, 11.03.2022 04:00
question
Mathematics, 11.03.2022 04:10
Questions on the website: 13722359