The 'Magic Eight Ball' trademark and various 8-Ball answers are used without permission of Mattel Inc. Is in no way affiliated with this web page, or with its proprieter, or with the 8 ball Twitter bot with which we are also associated. The purported magical powers of the Online Magic Eight Ball are in no way meant to imply. Any of the numbers, 2, 8, 20, 28, 50, 82, or 126, that represent the number of neutrons or protons in strongly bound and exceptionally stable atomic nuclei.

Learn how to Find Magic Number in C Programming. A Magic Integer is also known as Ramanujan’s Number. Find more about magic integers on Wikipedia. You must know how to Reverse the Digits of a Number and how to find the Sum of Digits of a Number to understand this program better.

What is a Magic Number?

Also known as Hardy-Ramanujan Number or Taxicab Number, it is an integer in which, when its digits are added, it produces a sum which, when multiplied by the its reversed number, fetches the original integer.

Must Read: C Program To Find if a Number is a Strong Integer or Not

Magic number 2 8 8 2

Example

81

8 + 1 = 9

9 × 9 = 81

1729

1 + 7 + 2 + 9 = 19

19 × 91 = 1729

How To Check if an Integer is a Magic Number or Not?

  1. Fetch a Number from the User.
  2. Find Sum of Digits and Multiply it with the its Reverse.
  3. If the Product is same as the original number, it’s a Magic Number.

Steps:

  1. Input a Number and store it in N.
  2. Find Sum of Digits of the Original Number and store it in A.
  3. Reverse the Digits of A and store it in B.
  4. Multiply A and B and store it in C.
  5. If C N, then it is a Magic Integer.

Magic Number 2 8 8 X 10

Must Read: C Program To Find Sum of Two Complex Numbers

Note: This C Program To Print Magic Numbers has been compiled with GNU GCC Compiler and developed using gEdit Editor and Terminal in Linux Ubuntu Operating System.

Magic Number 2 8 8 X 8

C Program To Check if a Number is a Magic Number or Not

Magic Number 2 8 8 Cm

2
4
6
8
10
12
14
16
18
20
22
24
26
28
30
32
34
36
38
40
42
44
46
48
50
52
54
56
intreverse_digits(int);
intmain()
intsum,num,reverse;
scanf('%d',&num);
if(sum<10)
if((sum *sum)num)
printf('n%d is a Magic Integern',num);
else
printf('n%d is Not a Magic Integern',num);
return0;
reverse=reverse_digits(sum);
{
}
{
}
}
intsum_of_digits(intnum)
intsum=0;
{
num=num/10;
returnsum;
{
while(num>0)
reverse=(reverse *10)+(num%10);
}
}

Must Read: C Program To Check if Number is Narcissistic Number or Not

Number 2 Numerology

Output

If you have any compilation errors or doubts in this code to find magic integers in c programming, let us know about it in the comment section below.

Magic Number 2 8 8 2

Related