1.demo_while–.c
#include <stdio.h>
int main()
{
int times;
times = 10;
while(times){ // 只要条件为真,就一直执行,if,只执行一次
//避免死循环,到一定程度能满足退出条件。除C51单片机代码
puts("I love you");
times--;
}
return 0;
}
2.demo_while++.c
#include <stdio.h>
int main()
{
int times = 0;
while(times < 10 ){
puts("I love you");
printf("times = %d\n",times);
times++;
}
return 0;
}