Header Ads Widget

Responsive Advertisement

Ticker

6/recent/ticker-posts

Write a c program to check whether a number is strong or not.

  #include<stdio.h>  
   #include<conio.h>  
     int main()  
      {  
        int num,i,f,r,sum=0,t;  
        printf("Enter a number: ");  
        scanf("%d",&num);  
        temp=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==t)  
       printf("%d is a strong number",t);  
     else  
       printf("%d is not a strong number",t);  
     return 0;  
   }  
 Sample output:  
 Enter a number: 145  
 145 is a strong number 

 

Post a Comment

0 Comments