c# 数组强转
Here you will get program for strong number in C.
在这里,您将获得C语言中强数的程序。
What is Strong Number?
什么是强数?
A number in which the sum of factorial of individual digits is equal to the number is called strong number.
各个数字的阶乘之和等于该数字的数字称为强数。
For example, 145 is a strong number because 145=(!1)+(!4)+(!5)=1+24+120=145
例如,145是一个强数,因为145 =(!1)+(!4)+(!5)= 1 + 24 + 120 = 145
The below C program will check whether a given number in strong number or not.
下面的C程序将检查给定数字是否为强数。
C强数程序 (Program for Strong Number in C)
#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
输出量
Comment below if you are facing any difficulty to understand above strong number in C program.
如果您在理解C程序中的上述强数字时遇到任何困难,请在下面评论。
翻译自: https://www.thecrazyprogrammer.com/2016/01/strong-number-in-c.html
c# 数组强转