본문 바로가기

Algorithm/백준

[백준] 2741: N 찍기 - JAVA [자바]

 


 

문제


 

 

문제 풀이


import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        for (int i = 1; i <= a; i++) {
            System.out.println(i);
            
        }
    }
}

 

  • a를 입력한 뒤 1 부터 a 까지 출력하였습니다.

 

결과