当前位置:网站首页>C language learning log 10.4
C language learning log 10.4
2022-06-13 04:56:00 【Today is also a day without baldness】
One . Loop statement
if Statement can determine whether the condition is satisfied , When you are satisfied, do the corresponding action , The loop statement can be used when the condition is satisfied , Keep repeating some actions .
Repeated statements ( Loop statement ) You can execute other statements multiple times , It checks whether a logical condition is satisfied , Execute its loop body only when it is satisfied .
while A statement is a loop statement , It will first determine whether a condition is satisfied , If the conditions are met , Execute the statement or statement parentheses that follow , Then judge again whether the conditions are met , If the conditions are met, execute again , Until the conditions are not met . The statement or statement parentheses that follow , It's a circular body .
do-while Circulation and while The loop is very similar , The only difference is that we only judge the condition at the end of the loop body execution . in other words , in any case , The loop is executed at least once , And then judge the conditions . And while The same thing about the cycle is , Execute the loop when the conditions are met , End the cycle when the condition is not satisfied .
Two . Measuring digit ( Greater than or equal to 0 Number of numbers )
#include<stdio.h>
int main(void)
{ int n=0; int a;
scanf("%d",&a);
n++;
a/=10;
while(a>0){
n++;
a/=10;}
printf("%d",n);
}Tip: Several boundary numbers commonly used in testing programs :“ Single digit ;10;0; negative ”
边栏推荐
- 2022 question bank and answers for operation certificate examination of safety production management personnel in road transport enterprises
- Basic syntax example for go
- Use go to add massive data to MySQL
- [LeetCode]-滑动窗口
- Configuration used by automatic teaching evaluation script
- Nodejs parsing get request URL string
- Trust programming - linked lists: use struct to implement linked lists, use heap to merge K ascending linked lists, and customize display
- Bomb disposal cat
- Section 6 - pointers
- Advanced C - Section 2 - pointers
猜你喜欢

Chapter 13 abstraction: address space

如何只用4步,实现一个自定义JDBC驱动?

Logical point

Colab tutorial (super detailed version) and colab pro/pro+ evaluation

Leetcode game 297 (20220612)

Cesium:CesiumLab制作影像切片与切片加载

MySQL8.0.13安装教程(有图)

CMB written test graphical reasoning

Elliptic curve encryption

Avantages de win8.1 et win10
随机推荐
Analysis of the principle of V-model and its application in user defined components
UNO
Section 3 - functions
Crawler scrapy framework learning 2
Tita: Xinrui group uses one-to-one talk to promote the success of performance change
[leetcode]- sliding window
详解OpenCV的函数cv::add(),并附各种情况的示例代码和运行结果
General communication protocol for industrial Internet
Advantages of win8.1 and win10
Robot pose description and coordinate transformation
Win8.1和Win10各自的优势
Opencv image storage and reading
Kaggle time series tutorial
Trust programming - linked lists: use struct to implement linked lists, use heap to merge K ascending linked lists, and customize display
Simple-SR:Best-Buddy GANs for Highly Detailed Image Super-Resolution论文浅析
Colab tutorial (super detailed version) and colab pro/pro+ evaluation
shell变量学习笔记
Shell built-in string substitution
Createanonymousthreadx passes parameters to anonymous threads
String()和toString()方法得区别