for循环语句

基本语法和定义:

 

 例:

int i;

for (i = 1; i<=5; i++){

  printf("\n hello!");

}

实现打印五行hello

以下是流程图:

 

 注意事项

 

 2)的例子如下(上面的变种):

int i = 1;

for (; i<=5; ){

  printf("\n hello!");

  i++;

}

 

 注意要类型一样,用逗号隔开

其中的count应赋值,或者给予一个常量

posted @ 2022-09-23 14:46  Morning枫  阅读(60)  评论(0)    收藏  举报