当前位置:网站首页>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
边栏推荐
- Taishan Office Technology Lecture: all elements in a row have the same height
- Ansible自动化运维
- Online text digit recognition list summation tool
- Summary of basic concepts of moosefs
- leetcode:91. Decoding method [DFS + memorization]
- An in-depth analysis of the election mechanism in kubernetes
- Can the flick CDC be used for incremental synchronization from Oracle to MySQL
- Efficient implementation of dynamiccast with template function and specialization function
- Day9 ---- 用户注册与登录
- 中国数据库崛起,阿里云李飞飞:中国云数据库多种主流技术创新已领先国外
猜你喜欢

Vs2013 how to make the program run on other computers

Still stay up late every day and work overtime to make statements? In fact, you don't know how to make reports efficiently

Kr-gcn: an interpretable recommendation system based on knowledge aware reasoning

一键式文件共享软件Jirafeau

Qt5.14.2 error connecting to the MySQL database of Ubuntu 20.04

服务器快速搭建AList集成网盘网站【宝塔面板一键部署AList】

Guangzhou launched a campaign to promote the safety of bottled gas and popularized the knowledge of gas safety

地方/园区如何做好产业分析?

#第三天

Free PDF to word software sharing, these software must know!
随机推荐
5-1 system vulnerability scanning
IFLYTEK AI learning machine summer new product launch AI + education depth combination to create a new height of products
Conceptual understanding of deep learning (notes)
Build a short video platform, fade in and fade out, and support left sliding and right pulley to broadcast pictures
Unicom warehousing | all Unicom companies that need to sell their products need to enter the general warehouse first
With the rise of China's database, Alibaba cloud lifeifei: China's cloud database has taken the lead in various mainstream technological innovations abroad
阶段性总结与思考
交友平台小程序制作开发代码分享
触摸按键与按键控制对应的LED状态翻转
5-minute quick start pytest testing framework
Moosefs tuning notes
Portable 4K audio and video conference terminal all-in-one machine with 8x digital zoom
详细聊聊MySQL中auto_increment有什么作用
从检查点恢复后读取不到mysql的数据有那位兄台知道原因吗
What if MySQL fails to store emoticons
还天天熬夜加班做报表?其实你根本不懂如何高效做报表
VS无法定位程序输入点于动态链接库
股票开户安全吗?上海股票开户。
Spark集群安装
深入解析kubernetes controller-runtime