public class MultiFor {
	public static void main(String[] args){
		int total =0;
		for (int i=1; i<=100; i++){
			total = total +i;

			if(i% 10 ==0){
				System.out.println("1부터"+i+"까지의 합계는"+total);
			}

		}
		//구구단 2단 출력하기
		for(int i=1;i<10;i++){
			System.out.println("2*"+i+" = " +2*i);
		}
		System.out.println("\n--------------");
		//구구단 2단 거꾸로 출력하기
		for(int e=9;e>=1;e--){
			System.out.println("2*"+e+" = " +2*e);

		}
	}
}







'Java > 2012.04 강좌' 카테고리의 다른 글

5일차 구구단 연습  (0) 2012.04.09
4일차 for문을 이용한 구구단  (0) 2012.04.06
4일차 제어문 활용  (0) 2012.04.06
4일차 while 문 연습  (0) 2012.04.06
4일차 for 문 연습  (0) 2012.04.06

+ Recent posts