当前位置:网站首页>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 :
边栏推荐
- 栈题目:有效括号的嵌套深度
- [explanation of JDBC and internal classes]
- How can clothing stores make profits?
- How Oracle backs up indexes
- Initial experience of addresssanitizer Technology
- 请问 flinksql对接cdc时 如何实现计算某个字段update前后的差异 ?
- $parent(获取父组件) 和 $root(获取根组件)
- ViewModelProvider. Of obsolete solution
- 云备份项目
- How does an enterprise manage data? Share the experience summary of four aspects of data governance
猜你喜欢
The currently released SKU (sales specification) information contains words that are suspected to have nothing to do with baby
transform-origin属性详解
Special behavior of main function in import statement
How to model and simulate the target robot [mathematical / control significance]
How can gyms improve their competitiveness?
子组件传递给父组件
Role of virtual machine
大咖云集|NextArch基金会云开发Meetup来啦
Precise space-time travel flow regulation system - ultra-high precision positioning system based on UWB
$parent(获取父组件) 和 $root(获取根组件)
随机推荐
Flexible layout (II)
Reflection (II)
Select the product attribute pop-up box to pop up the animation effect from the bottom
Le Service MySQL manque dans le service informatique
弹性布局(一)
Pass parent component to child component: props
leetcode 509. Fibonacci number
This article introduces you to the characteristics, purposes and basic function examples of static routing
请教一下,监听pgsql ,怎样可以监听多个schema和table
[Luogu p1971] rabbit and egg game (bipartite game)
PostgreSQL source code (59) analysis of transaction ID allocation and overflow judgment methods
oracle如何备份索引
$refs: get the element object or sub component instance in the component:
Maze games based on JS
Matlab tips (29) polynomial fitting plotfit
MySQL user permissions
Network foundation - header, encapsulation and unpacking
Multidisciplinary integration
The currently released SKU (sales specification) information contains words that are suspected to have nothing to do with baby
Advantages of using net core / why