알고리즘/백준
[백준 2741번 ː 자바(JAVA)] N 찍기
그릿er
2020. 4. 17. 20:20
<문제>
자연수 N이 주어졌을 때, 1부터 N까지 한 줄에 하나씩 출력하는 프로그램을 작성하시오.
1
2
3
4
5
6
7
8
9
10
11
12
|
public 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);
}
}
}
|