Strong Number Logical Program in C

This Strong Number Logical Program in C page providing the logical implementation of Strong number program using C language Syntax.


Definition: Sum of factorials of individual digits is equals to given number.

#include<stdio.h>
void main()
{
int n, r, sum=0 , temp, fact, i;
printf(“Enter one number : “);
scanf(“%d”, &n);

temp=n ;
while(n>0)
{
r=n%10;
fact=1 ;
for(i=r ; i>=1 ; i–)
{
fact = fact * i ;
}
sum = sum + fact;
n=n/10;
}
n=temp;
if(n==sum)
printf(“Strong number”);
else
printf(“Not a Strong number”);
}

Share this