当前位置:网站首页>[code hoof set novice village 600 question] calculate the number of digits of an integer
[code hoof set novice village 600 question] calculate the number of digits of an integer
2022-07-19 13:37:00 【Sandm *】
The title is as follows :

Their thinking :
utilize while Loops and operators / To solve the
Be careful :
The data should be discussed in two cases ,
If you don't judge
When the test data is numeric 0 when , The number of digits given is 0 , instead of 1
Reference code :
#include<bits/stdc++.h>
using namespace std;
int main( )
{
int data = 0;
cin >> data;
int count = 0;
if(data == 0)
{
count++;
}
else
{
while(data)// When the number given is 0 The number of digits given by the program is 0, instead of 1
{
data = data / 10;
count++;
}
}
cout << count;
return 0;
}边栏推荐
- Onvif protocol related: common class description
- A general memory management driver code is sorted out
- Codeforces Round #808 (Div. 2)ABCD
- LeetCode 0118. Yanghui triangle
- Li Kou's 302 weekly match
- Atmospheric non isohalo effect
- 力扣第 302 场周赛
- Weekly summary (*65): planned output
- Realize automatic logging
- Onvif protocol related: 3.1.4 get the stream address in digest mode
猜你喜欢

Flutter uses animatedswitcher to switch scenes

jvm自学总结

ONVIF Protocol Related: 4.1.3 WS - username token Method get capture d'écran URL

【码蹄集新手村 600 题】计算一个整数有多少位数

Li Kou 70 - climbing stairs - Dynamic Planning

Reg of sequential logic and combinatorial logic

【码蹄集新手村 600 题】float 与 double 的格式说明符

codeforce:A. Difference Operations【数学思维】

Module 7 (Architecture Design of King glory mall)

Onvif protocol related: 3.1.2 get the token list in digest mode
随机推荐
jvm自学总结
Attachment handling of SAP Fiori
【考研词汇训练营】Day 5 —— alarmist,cooperate,point,benefit,industrial,revolution,mechanize
【7.12】Codeforces Round #806 (Div. 4)
OpenSSL操作
Method of converting video format to ffmpeg and exporting GIF dynamic graph
弘业期货网上开户安全吗?有没有开户指引?
如何优雅的升级 Flink Job?
Acwing game 60
Onvif protocol related: 2.1.2 get screenshot URL in none mode
STM32F1与STM32CubeIDE编程实例-MPU-6050 六轴(陀螺仪 + 加速度计)驱动
Design and Simulation of anti reverse connection circuit based on MOS transistor
[pyGame learning notes] 7 event
S32K148_CAN驱动(裸机开发)
【7.8】Educational Codeforces Round 131 (Rated for Div. 2)
[try to hack] ARP and ARP deception
VMware imports ova/ovf virtual machine files
如何优雅的升级 Flink Job?
每周小结(*65):有计划的输出
Force buckle 64 minimum path sum -- Introduction to dynamic programming