#include<stdio.h>
int main()
{
int n,i=-1,j,k,fact=1;
int array[100];
int fact_sum=0;
printf("Please Enter A Number: ");
scanf("%d",&n);
int number=n;
///saving the number by 1 digit
while(n!=0)
{
i++;
array[i]=n%10;
n=n/10;
}
///calculate per digit factorial and add them
for(j=0;j<=i;j++)
{
for(k=1;k<=array[j];k++)
{
fact=fact*k;
}
fact_sum=fact_sum+fact;
fact=1;
}
/// Compare total factorial value with the main number
if(fact_sum==number)
{
printf("
This is a Strong Number
");
}
else
{
printf("
This is not a Strong Number
");
}
return 0;
}
What is Strong Number?- https://codetohaven.blogspot.com/2018/01/what-is-strong-number-in-c.html
Output
Please Enter A Number:145
This is a Strong Number
Add your comment