当前位置:网站首页>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;
} 边栏推荐
- Go multithreaded data search
- 海思3559万能平台搭建:在截获的YUV图像上画框
- Xshell configuration xforward forwarding Firefox browser
- Sword finger offer II 099 Sum of minimum paths - double hundred code
- Mask R-CNN
- Splunk audit 的设定
- Motivation du Protocole de chiffrement avancé AES
- Qt QSplitter拆分器
- 景联文科技低价策略帮助AI企业降低模型训练成本
- 用matlab调用vs2015来编译vs工程
猜你喜欢

Motivation du Protocole de chiffrement avancé AES
![The kth largest element in the [leetcode] array [215]](/img/72/d3e46a820796a48b458cd2d0a18f8f.png)
The kth largest element in the [leetcode] array [215]

Application of containerization technology in embedded field

Webrtc audio and video capture and playback examples and mediastream media stream analysis

海思3559万能平台搭建:在截获的YUV图像上旋转操作

Lambda表达式:一篇文章带你通透

Minimum spanning tree

Generics and reflection, this is enough

首批 | 腾讯云完成国内首个云原生安全成熟度评估
![Jielizhi, production line assembly link [chapter]](/img/0d/102596ad13aafd9c6133509d9064dd.png)
Jielizhi, production line assembly link [chapter]
随机推荐
Distributed monitoring system ZABBIX
[chestnut sugar GIS] ArcScene - how to make elevation map with height
Static file display problem
Lambda expression: an article takes you through
數據分析學習記錄--用EXCEL完成簡單的單因素方差分析
easyclick,ec权朗网络验证源码
4 special cases! Schools in area a adopt the re examination score line in area B!
[hardware] origin of standard resistance value
[NPUCTF2020]ezlogin xPATH注入
Loss function~
Sword finger offer II 099 Sum of minimum paths - double hundred code
Looking at Ctrip's toughness and vision from the Q1 financial report in 2022
Application of containerization technology in embedded field
Use of recyclerview with viewbinding
Methods to solve the tampering of Chrome browser and edeg browser homepage
Introduction to the latest plan of horizon in April 2022
Boot actuator - Prometheus use
20220527_数据库过程_语句留档
Construction of Hisilicon 3559 universal platform: draw a frame on the captured YUV image
密码技术---密钥和SSL/TLS