Magic number in c

A magic number in C first we  find the sum of digits of the given number then find reverse of sum and then product between sum of digits and reverse sum numbers. if the product value is same as original number value it is Magic number Example like 81,1458,1729

sum of digits  of 1458
1 +4 +5 +8 = 18   now ..
Reverse of digit of  sum  is 81

now product of 18 * 81 and the result is 1458
which is a original number

So 1458 is a magic number.

Other magic numbers are 81,1458,1729  etc..

Program Code Definition

write a c program using while loop given any integer number from keyboard and display it is Magic Number or not.

Source Code Of Magic Number input vlaue  through Keyboard

Output of Magic Number

Enter any Number : 1458
Sum of Digits of number = 18
Reverse Number of Sum = 81
1458 is a Magic number

One More Program Code Definition for Magic Number

write a c program display  Magic integer  Number  from 1 to 32766


Output of Magic Number

Magic  Numbers are   :
1    81      1458      1729
(Visited 1,456 times, 1 visits today)

1 thought on “Magic number in c

  1. rm,dm and prd all are identifier all are variables
    rm is remainder of a number
    dm is Back up of of Original number
    prd is product of sum of digit(given number) and reverse value of sum

Leave a Reply

Your email address will not be published. Required fields are marked *

Reload Image