GoogelAddUnit1

Thursday 10 March 2011

C Program to check whether the given number is strong or not.?


/*  checking for strong number  */                                                        
#include<stdio.h>
#include<conio.h>
void main()
{
   int n,s,fact=1,sum=0,m,r;
   printf("\n enter the value");
   scanf("%d",&n);
   s=n;
   while(n>0)
   {
      m=n%10;
      fact=1;
      while(m>0)
      {
            fact=fact*m;
            m--;
      }
      sum=sum+fact;
      n=n/10;
   }
   printf("\n strong no...%d",sum);
   if(s==sum)
     printf("\n the given no is strong");
   else
    printf("\n given no is not strong");
      getch();
}

No comments:

Post a Comment