#include <stdio.h>
void main(){
int i, total=0;
for(i=0; i<10; i++){
if(!(i%2)) continue;
//i=0일때 i%2=0, 1(참)이니까 continue
//i=1일때 i%2=1, 0(거짓)이니까 total+=1
//i=2일때 i%2=0, 1(참)이니까 continue
//i=3일때 i%2=1, 0(거짓)이니까 total+=3
//규칙: i가 홀수이면 i를 더하고, 짝수이면 continue한다.
total=total+i;
//1,3,5,7,9 총합 = 25 출력
}
printf("%d\n", total); //25 출력
}
To embed this project on your website, copy the following code and paste it into your website's HTML: