Print Strong Numbers in Given Limit using C

This “Print Strong Numbers in Given Limit using C” post explains clearly how to implement logic to find out all the strong numbers in the given limit using C language Syntax.


  • These are the numbers whose sum of factorial of digits is equal to the original number.
  • Following program prints all the Strong numbers in the given limit.#include<stdio.h>
    void main()
    {
    int limit, n, i, sum, temp, fact, r;
    printf(“Enter limit : “);
    scanf(“%d”, &limit);

    for(n=1 ; n<=limit ; n++)
    {
    sum=0 ;
    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(“%d is Strong number \n”, n);
    }
    }
    }

Share this