当前位置:网站首页>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 :
![]()
边栏推荐
- SQLMAP使用教程(四)实战技巧三之绕过防火墙
- 组件的通信
- MySQL binlog related commands
- Non empty verification of collection in SQL
- Composition API 前提
- Config distributed configuration center
- transform-origin属性详解
- Jetpack compose is much more than a UI framework~
- JDBC database connection pool usage problem
- from . onnxruntime_ pybind11_ State Import * noqa ddddocr operation error
猜你喜欢
随机推荐
Tool class: object to map hump to underline underline hump
Fast quantitative, abbkine protein quantitative kit BCA method is coming!
Le Service MySQL manque dans le service informatique
Reflection (II)
Release notes of JMeter version 5.5
A slow SQL drags the whole system down
详解机器翻译任务中的BLEU
Circulating tumor cells - here comes abnova's solution
弹性布局(二)
IP address
请教一个问题,flink oracle cdc,读取一个没有更新操作的表,隔十几秒就重复读取全量数据
OOM(内存溢出)造成原因及解决方案
Prime partner of Huawei machine test questions
点亮显示屏的几个重要步骤
"Xiaodeng in operation and maintenance" meets the compliance requirements of gdpr
SQLMAP使用教程(四)实战技巧三之绕过防火墙
【JDBC以及内部类的讲解】
The startup of MySQL installed in RPM mode of Linux system failed
Composition API 前提
LC interview question 02.07 Linked list intersection & lc142 Circular linked list II









