当前位置:网站首页>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;
}
边栏推荐
- MySQL queries nearby data And sort by distance
- Introduction to the latest plan of horizon in April 2022
- Lambda expression: an article takes you through
- 聊聊内存模型与内存序
- Construction of Hisilicon 3559 universal platform: draw a frame on the captured YUV image
- 移动端 1px 像素兼容性问题,实现1px 边框
- 阿里云有奖体验:如何使用 PolarDB-X
- Typical case of data annotation: how does jinglianwen technology help enterprises build data solutions
- 情感对话识别与生成简述
- 泛型与反射,看这篇就够了
猜你喜欢
数据标注典型案例,景联文科技如何助力企业搭建数据方案
[NPUCTF2020]ezlogin xPATH注入
Data analysis learning records -- complete a simple one-way ANOVA with Excel
Analyse des données dossiers d'apprentissage - - analyse simple de la variance à facteur unique avec Excel
创新实力再获认可!腾讯安全MSS获2022年度云原生安全守护先锋
Redis 过期策略+conf 记录
Jatpack------LiveData
Boot actuator - Prometheus use
Lambda expression: an article takes you through
Prometheus deployment
随机推荐
Generics and reflection, this is enough
PotPlayer设置最小化的快捷键
阿里云有奖体验:如何使用 PolarDB-X
[Yangcheng cup 2020] easyphp
Boot actuator - Prometheus use
泛型与反射,看这篇就够了
[leetcode] reverse the word III in the string [557]
Application of containerization technology in embedded field
Analyse des données dossiers d'apprentissage - - analyse simple de la variance à facteur unique avec Excel
Typical case of data annotation: how does jinglianwen technology help enterprises build data solutions
QT qsplitter splitter
LeetCode 968. 监控二叉树
设置单击右键可以选择用VS Code打开文件
[chestnut sugar GIS] how does global mapper batch produce ground contour lines through DSM
P7072 [csp-j2020] live broadcast Award
Lambda表达式:一篇文章带你通透
数据分析学习记录(二)---响应曲面法及Design-Expert的简单使用
Xiaopeng P7 had an accident and the airbag did not pop up. Is this normal?
Looking at Ctrip's toughness and vision from the Q1 financial report in 2022
为什么RTOS系统要使用MPU?