This code checks a number is magic or not. Magic number: repeating the iteration till we are left with a single digit. If the digit left over is 1, then the original number is called a magic number. example Consider the number 55. The sum of the digits of 55 is (5+5) = 10. The sum of the digits of 10 is (1+0) = 1. Since the process is terminating with 1 as the last single digit, 55 is considered to be a magic number.
This code checks a number is magic or not. Magic number: repeating the iteration till we are left with a single digit. If the digit left over is 1, then the original number is called a magic number. example Consider the number 55. The sum of the digits of 55 is (5+5) = 10. The sum of the digits of 10 is (1+0) = 1. Since the process is terminating with 1 as the last single digit, 55 is considered to be a magic number.