c# 数组强转_C中的强数

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

输出量

Strong Number in C

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# 数组强转

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值