当前位置:网站首页>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 :
边栏推荐
- JS decorator @decorator learning notes
- Graduation design game mall
- Jesd204b clock network
- JDBC database connection pool usage problem
- Special behavior of main function in import statement
- [explanation of JDBC and internal classes]
- jdbc数据库连接池使用问题
- Big coffee gathering | nextarch foundation cloud development meetup is coming
- Select the product attribute pop-up box to pop up the animation effect from the bottom
- MySQL service is missing from computer service
猜你喜欢
$parent(获取父组件) 和 $root(获取根组件)
Paranoid unqualified company
Nesting and splitting of components
Special behavior of main function in import statement
RuntimeError: CUDA error: CUBLAS_ STATUS_ ALLOC_ Failed when calling `cublascreate (handle) `problem solving
"Xiaodeng in operation and maintenance" meets the compliance requirements of gdpr
Lm11 reconstruction of K-line and construction of timing trading strategy
Basic process of network transmission using tcp/ip four layer model
CompletableFuture使用详解
How to do sports training in venues?
随机推荐
Asynchronous components and suspend (in real development)
父组件传递给子组件:Props
Hidden Markov model (HMM) learning notes
Academic report series (VI) - autonomous driving on the journey to full autonomy
About binary cannot express decimals accurately
Basic process of network transmission using tcp/ip four layer model
Bus message bus
$parent(获取父组件) 和 $root(获取根组件)
Chinese and English instructions prosci LAG-3 recombinant protein
非父子组件的通信
Sqlserver multithreaded query problem
请问 flinksql对接cdc时 如何实现计算某个字段update前后的差异 ?
transform-origin属性详解
Please ask a question, flick Oracle CDC, read a table without update operation, and repeatedly read the full amount of data every ten seconds
Matlab tips (30) nonlinear fitting lsqcurefit
Modify the jupyter notebook file path
多线程与高并发(9)——AQS其他同步组件(Semaphore、ReentrantReadWriteLock、Exchanger)
Databinding exception of kotlin
Abnova circulating tumor DNA whole blood isolation, genomic DNA extraction and analysis
After the promotion, sales volume and flow are both. Is it really easy to relax?