Strong Number: A strong number is a number in which the sum of factorial of all the digits of the given number is equal to the given number. E.g. 145=1!+4!+5!
#include<stdio.h>
#include<conio.h>
void main()
{
int i=0,n;
long double f=1;
clrscr();
printf("Enter the number : ");
scanf("%d",&n);
#include<stdio.h>
#include<conio.h>
void main()
{
int i=0,n;
long double f=1;
clrscr();
printf("Enter the number : ");
scanf("%d",&n);
for(i=n;i>0;i=i/10)
{
r=i%10;
for(i=r;i>0;i--)
f=f*i;
f=f*i;
s=s+f;
}
if(s==n)
printf("The number is strong.");
else
printf("The number is not strong number.");
getch();
}
No comments:
Post a Comment