当前位置:网站首页>1089: highest order of factorial
1089: highest order of factorial
2022-07-07 07:17:00 【Huaze flowers】
Title Description
Enter a positive integer n. Output n! The number on the highest digit of .
Input
Enter a positive integer n(n No more than 1000).
Output
Output n! The number on the highest digit of .
The sample input
1000
Sample output
4
Tips
Be careful double Type overflow problem .
Code :
//n The factorial
// Input :
//1000
// Output :
//4
#include <stdio.h>
int main ()
{
double sum=1.0;
int n,i;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
sum*=i*1.0;
while(sum>=10)
{
sum=sum/10;
}
}
printf("%.0lf",sum);
return 0;
}
Running results :

Submit :
![]()
边栏推荐
- Master-slave replication principle of MySQL
- 组件的嵌套和拆分
- Four goals for the construction of intelligent safety risk management and control platform for hazardous chemical enterprises in Chemical Industry Park
- 非父子组件的通信
- Answer to the second stage of the assignment of "information security management and evaluation" of the higher vocational group of the 2018 Jiangsu Vocational College skills competition
- JS small exercise ---- time sharing reminder and greeting, form password display hidden effect, text box focus event, closing advertisement
- Lm11 reconstruction of K-line and construction of timing trading strategy
- . Net core accesses uncommon static file types (MIME types)
- Non empty verification of collection in SQL
- How to share the same storage among multiple kubernetes clusters
猜你喜欢

Implementation of AVL tree

AVL树的实现

. Net 5 fluentftp connection FTP failure problem: this operation is only allowed using a successfully authenticated context

Le Service MySQL manque dans le service informatique

How does an enterprise manage data? Share the experience summary of four aspects of data governance

Asynchronous components and suspend (in real development)

Pass parent component to child component: props

MySQL view bin log and recover data

Release notes of JMeter version 5.5

Basic process of network transmission using tcp/ip four layer model
随机推荐
.net core 访问不常见的静态文件类型(MIME 类型)
$parent(获取父组件) 和 $root(获取根组件)
Brand · consultation standardization
栈题目:有效括号的嵌套深度
from . onnxruntime_ pybind11_ State Import * noqa ddddocr operation error
Jesd204b clock network
Chinese and English instructions prosci LAG-3 recombinant protein
How DHCP router works
MySQL user permissions
MySQL binlog related commands
Abnova circulating tumor DNA whole blood isolation, genomic DNA extraction and analysis
js小练习
From zero to one, I will teach you to build the "clip search by text" search service (2): 5 minutes to realize the prototype
JS small exercise ---- time sharing reminder and greeting, form password display hidden effect, text box focus event, closing advertisement
oracle如何备份索引
Readonly read only
. Net core accesses uncommon static file types (MIME types)
抽丝剥茧C语言(高阶)指针的进阶
toRefs API 与 toRef Api
RuntimeError: CUDA error: CUBLAS_ STATUS_ ALLOC_ Failed when calling `cublascreate (handle) `problem solving