10/11 c언어 조건문 break,continue
C
#include <stdio.h>
int main() {
int i;
for(i=1;i<=30;i++){
printf("%d번 학생\n" , i);
if(i>=6){
printf("나머지는 집에 가세요.");
break; //반복을 끝냄
}
}
printf("\n");
for(i=1;i<=30;i++){
if(i == 7){
printf("%d번 학생은 결석입니다\n" , i);
continue;
}
printf("%d번 학생 발표 준비하세요.\n" , i);
}
}
Output
Embed on website
To embed this program on your website, copy the following code and paste it into your website's HTML:
Comments
This comment belongs to a banned user and is only visible to admins.
This comment belongs to a deleted user and is only visible to admins.