Strong Number in C

Here you will get a program for a strong number in C.

What is Strong Number?

A number where the entirety of factorial of individual digits is equivalent to the number is called a strong number.

For instance, 145 is a strong number in light of the fact that 145=(!1)+(!4)+(!5)=1+24+120=145

The beneath C program will check whether a given number is a strong number or not.

Program

#include<stdio.h>
 
int fact(int n){
	int i,fac=1;
	
	for(i=1;i<=n;++i){
		fac*=i;
	}
	
	return fac;
}
 
int main(){
	int n,t,sum,m;
	
	printf("Enter a number:");
	scanf("%d",&n);
	
	m=n;
	
	while(m!=0){
		t=m%10;
		sum+=fact(t);
		m=m/10;
	}
		
	if(sum==n){
		printf("Strong Number");
	}
	else{
		printf("Not Strong Number");
	}
	
	return 0;
}

Output

Remark underneath on the off chance that you are confronting any trouble to comprehend above solid number in C program.

DURGESH

I Love python, so I like machine learning a Lot and on the other hand, I like building apps and fun games I post blogs on my website for Tech enthusiast to learn and Share Information With The World.

Leave a Reply

Your email address will not be published. Required fields are marked *

3 + eleven =

Recent Content