Problem: Write a C program to check whether a number is Magic Number or not.

A magic number is that number whose sum of the digits is when multiplied by the reverse of the same sum results back the original number.

Example: 1729

Magic number in C

Steps to Check Magic Number in C

  1. Input a number.
  2. Calculate the sum of its digits.
  3. Multiply the computed sum with its reverse.
  4. check if the product is equal to the input number.
  5. If Yes, then the given number is Magic number else not.

Here is the implementation of same in C.


C Program for magic Number

In this tutorial, we learned to check magic number in C.

Leave a Reply

4 × 3 =