当前位置:网站首页>Doorplate making C language
Doorplate making C language
2022-07-02 23:08:00 【Large dish color】
House number making
Xiaolan wants to make house numbers for the residents in a street .
This street has 2020 Residents , House number from 1 To 2020 Number .
Xiaolan's method of making house number is to make it first 0 To 9 These numeric characters , Finally, paste the characters on the doorplate as needed , For example, the house number 1017 You need to paste the characters in turn 1、0、1、7, That is to say 1 Characters 0,2 Characters 1,1 Characters 7.
Please make all the 1 To 2020 House number , How many characters are needed in total 2?
Code :
#include<stdio.h>
int main()
{
int i,j,temp,count=0,a;
for(i=1;i<=2020;i++)
{
temp=i;
while(temp!=0)
{
a=temp%10; // Take the last digit of the number
if(a==2)
count++;
temp=temp/10; // Remove the last digit of the number
}
}
printf("%d",count);
return 0;
}
边栏推荐
- 海思3559万能平台搭建:在截获的YUV图像上画框
- Go multithreaded data search
- ServletContext learning diary 1
- Addition, deletion, modification and query of handwritten ORM (object relationship mapping)
- The kth largest element in the [leetcode] array [215]
- 在SOUI里使用真窗口时使用SOUI的滚动条
- Qt QScrollArea
- Learning records of data analysis (II) -- simple use of response surface method and design expert
- 【喜欢的诗词】好了歌
- WebRTC音视频采集和播放示例及MediaStream媒体流解析
猜你喜欢
Webrtc audio and video capture and playback examples and mediastream media stream analysis
Jielizhi, production line assembly link [chapter]
RecyclerView结合ViewBinding的使用
[chestnut sugar GIS] ArcScene - how to make elevation map with height
[Solved] Splunk: Cannot get username when all users are selected“
Mask R-CNN
Chow-Liu Tree
[leetcode] most elements [169]
boot actuator - prometheus使用
Detailed explanation and application of merging and sorting
随机推荐
Detailed explanation and application of merging and sorting
【硬件】标准阻值的由来
`Usage of ${}`
P1007 single log bridge
数据标注典型案例,景联文科技如何助力企业搭建数据方案
[leetcode] there are duplicate elements [217]
WebRTC音视频采集和播放示例及MediaStream媒体流解析
Solving ordinary differential equations with MATLAB
Minimum spanning tree
程序员版本的八荣八耻~
设置单击右键可以选择用VS Code打开文件
xshell配置xforward转发火狐浏览器
Configuration clic droit pour choisir d'ouvrir le fichier avec vs Code
景联文科技低价策略帮助AI企业降低模型训练成本
[hardware] origin of standard resistance value
从2022年Q1财报看携程的韧性和远景
P7072 [csp-j2020] live broadcast Award
Splunk audit setting
Performance optimization - rigorous mode
Uniapp wechat login returns user name and Avatar