当前位置:网站首页>ZZULIOJ:1017: 判断正整数位数
ZZULIOJ:1017: 判断正整数位数
2022-08-10 03:39:00 【追上】
1017: 判断正整数位数
时间限制: 1 Sec 内存限制: 128 MB
[状态] [讨论版] [提交] [命题人:admin]
题目描述
给定一个不多于5位的正整数,判断它是几位数,并输出。
输入
一个不多于5位的正整数。
输出
输出正整数的位数,单独占一行。
样例输入 Copy
111
样例输出 Copy
3
提示
使用函数log10(n),求出n的以10为底的对数,这个对数的整数部分,就是n的科学计数法中的指数,这个整数加1就是n的位数。
参考代码
#include <stdio.h>
#include <math.h>
int main()
{
double a;
int b;
scanf("%lf", &a);
b=(int)log10(a)+1;
printf("%d", b);
return 0;
}
边栏推荐
猜你喜欢
Flutter 如何安装 pub.dev 上的 package
matlab simulink response spectrum calculation
Software life cycle (the work of each phase of software engineering)
电话自动拨号在电脑上自动拨打
Evaluation and Construction of Enterprise Network Security Capability from the Sliding Ruler Model
Jackson的ObjectMapper在项目中的主要运用
maya图片如何导入
[STL]map与set
C语言顺序表(源码)
MindSpore官方RandomChoiceWithMask算子用例报错
随机推荐
Kotlin协程:父子协程的绑定与传递
YAPI使用
sql优化
@Autowired注解 --required a single bean, but 2 were found出现的原因以及解决方法
It's almost 35, still "did a little"?What happened to the test workers who had been in the industry for a few years?
软件的生命周期(软件工程各阶段的工作)
数据库设计中反映用户对数据要求的模式叫什么
How does a new tester do functional testing?Test thinking is really important
如何快速成为一名软件测试工程师?测试员月薪15k需要什么技术?
C语言原码,反码,补码与大小端
matlab simulink响应谱计算
itoa和aoti函数的自我实现
Do you know these basic types of software testing?
Small program subcontracting and subcontracting pre-download
js原型和原型链以及原型继承
Pen paper records
How to quickly become a software test engineer?What skills do testers need for a monthly salary of 15k?
ES高亮显示语法
leetcode 283:移动零
GBase 8s打开工具就报错“配置文件有误” !!!为什么