Discussion Forums

What is strong number and need C program to find strong number

Eminent Member
Joined: 8 months  ago
Posts: 26
27/01/2017 9:36 am

What is strong number and need C program to find strong number

Eminent Member
Joined: 5 years  ago
Posts: 26
31/01/2017 12:04 pm

Hi,

Definition for a Strong number:

When the sum of the factorial of a number's individual digits are equal to the number itself, then that number is called a strong number.

Example: 145 since 1! + 4! + 5! = 1 + 24 + 120 = 145.

C program to find strong number:

#include<stdio.h>

int main()

{

int num,i,fact,r,sum=0,temp;

printf("Please enter a number to find strong number");

scanf("%d",&num);

temp=num;

while(num)

{

i=1,fact=1;

r=num%10;

while(i<=r)

{

fact=fact*i;

i++;

}

sum=sum+fact;

num=num/10;

}

if(sum==temp)

printf("\nThe number %d is a strong number",temp);

else

printf("\nThe number %d is not a strong number",temp);

return 0;

}

Working

1. Online Compilers - Compile & Run your C/C++ programs: