검색결과 리스트
글
for문 Sample (1~10까지 덧셈)
개발/코딩
2013. 9. 12. 08:54
※코딩창
public class ForSample {
public static void main(String[] args) {
int i, j;
for (j = 0, i = 1; i <= 10; i++) {
j = j + i;
System.out.print(i);
if (i == 10) {
System.out.print('=');
System.out.print(j);
} else
System.out.print('+');
}
}
}
※결과 창
1+2+3+4+5+6+7+8+9+10=55
'개발 > 코딩' 카테고리의 다른 글
Continue문 (1~100까지 짝수의 합) (0) | 2013.09.12 |
---|---|
2중for문 (구구단) (0) | 2013.09.12 |
While문 Sample (점수 입력해서 평균) (0) | 2013.09.12 |
가위 바위 보 게임 (0) | 2013.09.12 |
폼안에 성적출력하기 (0) | 2013.09.12 |