반응형
2741번 : N 찍기
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | import java.util.Scanner; public class java2741 { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int num = scan.nextInt(); for(int i=1;i<num+1;i++) { System.out.println(i); } } } | cs |
2742번 : 기 찍 N
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | import java.util.Scanner; public class java2742 { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int num = scan.nextInt(); for(int i=num; i>0;i--) { System.out.println(i); } } } | cs |
2739 : 구구단
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | import java.util.Scanner; public class java2739 { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int num = scan.nextInt(); for(int i=1;i<10;i++) { System.out.println(num+" * "+i+" = "+num*i); } } } | cs |
2438 : 별찍기
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | import java.util.Scanner; public class java2438 { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int num = scan.nextInt(); for(int i=0;i<num;i++) { for(int j=0;j<i+1;j++) { System.out.print("*"); } System.out.print("\n"); } } } | cs |
반응형
'CS > Algorithm' 카테고리의 다른 글
[BFS] 백준 2606 바이러스 (0) | 2018.01.14 |
---|---|
[알고리즘] for문 이용하기2 (0) | 2017.10.21 |
[BOJ][JAVA][2839] 설탕옮기기 (0) | 2017.10.20 |
[알고리즘] 나머지, A+B-2 (0) | 2017.10.20 |
[알고리즘] 연산 (0) | 2017.10.19 |
댓글