balbhimk / hactoberfest_2021

Use this as learning repo on how to create successful pull requests. Very basic tasks on Python, CPP,JAVA,HTML
11 stars 62 forks source link

Create magicnum.py #51

Open abbhardwaj01 opened 3 years ago

abbhardwaj01 commented 3 years ago

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.