当前位置:网站首页>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 :
![]()
边栏推荐
- How to do sports training in venues?
- Anr principle and Practice
- Exception of DB2 getting table information: caused by: com ibm. db2.jcc. am. SqlException: [jcc][t4][1065][12306][4.25.13]
- 请问 flinksql对接cdc时 如何实现计算某个字段update前后的差异 ?
- MySQL binlog related commands
- Explain Bleu in machine translation task in detail
- Master-slave replication principle of MySQL
- [explanation of JDBC and internal classes]
- mips uclibc 交叉编译ffmpeg,支持 G711A 编解码
- Kuboard无法发送邮件和钉钉告警问题解决
猜你喜欢

Non empty verification of collection in SQL

Sword finger offer high quality code

AVL树的实现

This article introduces you to the characteristics, purposes and basic function examples of static routing

Composition API 前提

Tujia, muniao, meituan... Home stay summer war will start

mips uclibc 交叉编译ffmpeg,支持 G711A 编解码

Implementation of AVL tree
![How to model and simulate the target robot [mathematical / control significance]](/img/bd/79f6338751b6773859435c54430ec3.png)
How to model and simulate the target robot [mathematical / control significance]

Special behavior of main function in import statement
随机推荐
Networkx drawing and common library function coordinate drawing
Lvs+kept (DR mode) learning notes
Software acceptance test
SQLMAP使用教程(四)实战技巧三之绕过防火墙
关于数据库数据转移的问题,求各位解答下
Graduation design game mall
transform-origin属性详解
FPGA course: application scenario of jesd204b (dry goods sharing)
Abnova circulating tumor DNA whole blood isolation, genomic DNA extraction and analysis
[explanation of JDBC and internal classes]
Mobx knowledge point collection case (quick start)
Academic report series (VI) - autonomous driving on the journey to full autonomy
$refs: get the element object or sub component instance in the component:
Flexible layout (II)
【mysqld】Can't create/write to file
js小练习
Bindingexception exception (error reporting) processing
Please answer the questions about database data transfer
Unity C function notes
The currently released SKU (sales specification) information contains words that are suspected to have nothing to do with baby