Header Ads

Strong number

What is strong number ?
A number is called strong number if sum of the factorial of its digit is equal to number itself. 
Example: 145 since 1! + 4! + 5! = 1 + 24 + 120 = 145.

Here is a program regarding how to check strong number using c program :


#include<stdio.h>
#include<conio.h>
int main()
{
 int num,i,f,r,sum=0,num1;
 clrscr();
 printf("Enter a number: ");
 scanf("%d",&num);
 num1=num;
 while(num){
  i=1,f=1;
  r=num%10;
  while(i<=r){
   f=f*i;
   i++;
  }
  sum=sum+f;
  num=num/10;
 }
 if(sum==num1)
  printf("%d is a strong number",num1);
 else
  printf("%d is not a strong number",num1);
 getch();
 return 0;
}

OUTPUT :

Enter a number: 145
145 is a strong number_

145 is a strong number so its obviously shows that 145 is a strong number let us try some other value.

Enter a number: 146
146 is not a strong number_

you can check it is showing that 146 not a strong number because it is not a strong number.

If you found any problem in any problem or you have any question regarding program don't forget to leave a message in below comment box 

1 comment:

  1. pikashow Picasso Apps is a video streaming platform from where you can watch TV Shows, Web Series, IPL Live, and the Latest Movies for free.

    pikashow Picasso Apps is a video streaming platform from where you can watch TV Shows, Web Series, IPL Live, and the Latest Movies for free.

    What is the Factorial of One Hundred Before diving into the depths of the factorial of one hundred, let us first grasp the concept of factorials.

    ReplyDelete