C Program to Check Whether a Number is Magic Number or Not

What is a magic number?

  • Find the sum of digits of the given number.(1 + 7 + 2 + 9 => 19)
  • Reverse of digit sum output. ¬†Reverse of 19 is 91
  • Find the product of digit sum and the reverse of digit sum.(19 X 91 = 1729)
  • If the product value and the given input are same, then the given number is a magic number.(19 X 91 <=> 1729)
  • So, 1729 is a magic number.

Sample Input/Output
Enter the value for num:1729
1729 is a magic number
Enter the value for num:2378
2378 is not a magic number

You may also like...