当前位置:网站首页>C language tutorial – -6 loop statement
C language tutorial – -6 loop statement
2022-06-29 22:44:00 【Full stack programmer webmaster】
c Language introduction tutorial –-6 Loop statement
c The language provides the following types of loops . while loop for loop do…while loop
while loop
#include <stdio.h>
int main ()
{
/* Definition of local variables */
int a = 10;
/* while Loop execution */
while( a < 20 )
{
printf("a Value : %d\n", a);
a++;
}
return 0;
}for loop
#include <stdio.h>
int main ()
{
/* for Loop execution */
for( int a = 10; a < 20; a = a + 1 ) //for( Before circulation ; The loop condition ; After the cycle )
{
printf("a Value : %d\n", a);
}
return 0;
}do…while loop
#include <stdio.h>
int main ()
{
/* Definition of local variables */
int a = 10;
/* do Loop execution , Execute at least once before the condition is tested */
do
{
printf("a Value : %d\n", a);
a = a + 1;
}while( a < 20 );
return 0;
}It's circular up there 3 An example , I think the second one is the most used one for, So understand first for How to write , The lines . Write more by yourself .
Loop and conditional statements , Can make it up , Most of the code can be written .
Publisher : Full stack programmer stack length , Reprint please indicate the source :https://javaforall.cn/2899.html Link to the original text :https://javaforall.cn
边栏推荐
- laravel 关联模型 多态关系
- Introduction, deployment and application of moosefs
- Number theory - division and blocking
- 文件操作的底层原理(文件描述符与缓冲区)
- What if MySQL fails to store emoticons
- 每日刷题记录 (八)
- 论文浅尝 | KR-GCN: 知识感知推理的可解释推荐系统
- Ansible自动化运维
- 英语没学好到底能不能做coder,别再纠结了先学起来
- With the rise of China's database, Alibaba cloud lifeifei: China's cloud database has taken the lead in various mainstream technological innovations abroad
猜你喜欢

#第三天

Basic use of Nacos configuration center

解题元宇宙,网络游戏中的多元通信方案
![leetcode:91. Decoding method [DFS + memorization]](/img/8d/9f61961fa9cfc6809a7800913e8761.png)
leetcode:91. Decoding method [DFS + memorization]
MySQL lock common knowledge points & summary of interview questions

触摸按键与按键控制对应的LED状态翻转

Gnawing down the big bone - sorting (I)

软件测试方法和技术知识点有哪些?

云原生爱好者周刊:炫酷的 Grafana 监控面板集合

Three development trends of enterprise application viewed from the third technological revolution
随机推荐
Why does copying files on a shared folder on a local area network (ERP server) result in the loss of the local Internet
从第三次技术革命看企业应用三大开发趋势
One click file sharing software jirafeau
低代码、端到端,一小时构建IoT示例场景,声网发布灵隼物联网云平台
新手必须知道的 Kubernetes 架构
MySQL 锁常见知识点&面试题总结
Huawei's software testing director with 7 years' experience, several suggestions for all students who want to switch to software testing
文件操作的底层原理(文件描述符与缓冲区)
What if MySQL fails to store emoticons
Grep tool
5-1系统漏洞扫描
Deep parsing of kubernetes controller runtime
26 years old, 0 basic career change software test, from 3K to 16K monthly salary, a super complete learning guide compiled by me
Cloud native enthusiast weekly: cool collection of grafana monitoring panels
Summary of basic concepts of moosefs
0. grpc环境搭建
每日刷题记录 (八)
Nacos-配置中心基本使用
深入解析kubernetes controller-runtime
Processing of error b6267342 reported by AIX small machine in production environment