-
2741) N 찍기 - JAVA백준코딩일기 2020. 1. 1. 19:59
풀이)
입력되는 N이 100,000보다 작은 수 이므로 integer 형으로.
for 문을 이용해서 i=1 부터 i<=N 까지 반복문을 돌려서 출력하도록 한다.12345678910111213public class Main {public static void main(String[] args) {Scanner sc = new Scanner(System.in);int n = sc.nextInt();for(int i=1; i<=n; i++)System.out.println(i);}} cs'백준코딩일기' 카테고리의 다른 글
1676) 팩토리얼 0의 개수 - JAVA (0) 2020.01.15 1158) 조세푸스 문제 - JAVA (0) 2020.01.06 10814) 나이순 정렬 - JAVA (0) 2019.12.29 2751) 수 정렬하기 2 JAVA - 정렬 (0) 2019.12.26 2193) 이친수(pinary number) JAVA - DP (0) 2019.12.24