C Program to Check Whether a Number is Magic Number or Not2 min read

What is Magic Number?

A number is said to be a Magic Number if the sum of the digits of that number, when multiplied by the reverse number of sum of its digits, is equal to the original number.
Example: 1729 is a magic number.

C Magic Number

C Magic Number:
In the following C Program to check for magic Number, first, take the user input for the number which needed to be checked. Then, we find the sum of the digits of that number and then find the reverse of that sum of the digits.

Lastly, check if the multiplication of reverse and sum of the digits is equal to original entered number or not. If it is equal then print “Magic Number” else print “Not a magic Number” using if-else statement in c.


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

The Output of magic Number in C Programming.

C Program to print all magic number till N