Java/2012.04 강좌
4일차 2단 구구단 출력
Bohemian life
2012. 4. 6. 12:08
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); } } }