Discussion Forums

New User? Please read instructions!

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

  RSS

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

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


ReplyQuote
admin
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;

}


ReplyQuote
  
Working

Please Login or Register

Ask your questions or clarify your/others doubts from,

✅ Online Discussion Forums by Fresh2Refresh.com





Share this website !!!
Facebook Twitter Linkedin

Close
We Support JALLIKATTU !!!
We Support JALLIKATTU!
By Fresh2Refresh.com
Show Your Support as well. Thanks!