今天学习了循环/*
循环结构while
wky
*/
#include <stdio.h>
int main(){
//单层循环
int a = 0 ;
while (a<10) {
a++;
printf("hello word\n");
}
//双层循环
int b = 0 ;
while(b<3){
int a = 0 ;
while (a<5) {
a++;
printf("第%d次外循环中第%d次内循环\n",b,a);
}
b++;
}
printf("-----continue--------\n");
int d = 0 ;
//continue
while (d<10) {
if(5==d){
d++;
continue;
}
printf("第%d次 continue 循环 hello word\n",d);
d++;
}
printf("-----break--------\n");
int g = 0 ;
//break
while (g<10) {
if(5==g){
g++;
break;
}
printf("第%d次 break 循环 hello word\n",g);
g++;
}
return 0;
} |
|