#include <stdio.h>
int main() {
// 초기값 선언;
// while (조건) {
// 반복할 코드 (증감 포함)
// }
int i = 3;
while (i > 0) {
printf("%d\n", i--);
// i -= 1;
}
printf("땡\n");
// a는 1 2 3 4 5 나오도록
int a = 0;
while (a < 5) {
printf("a는 %d\n", ++a);
}
printf("----문제----\n");
// 출력 결과가 6 7 8 9 10
int b = 6;
while (b < 11) {
printf("%d ", b++);
}
printf("\n----숙제----\n");
int battery = 100;
while (battery >= 0) {
printf("배터리 잔량 : %d\n", battery);
battery -= 25; //battery = battery - 25
}
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: