SWEA - [d1] 1541 거꾸로 출력해 보아요

Esther·2022년 11월 19일
0

SWEA

목록 보기
18/46

주어진 숫자부터 0까지 순서대로 찍어보세요

아래는 입력된 숫자가 N일 때 거꾸로 출력

입력
8
출력
8 7 6 5 4 3 2 1 0

package prc_d1;

import java.util.Scanner;

public class P1545 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		for (int i = N; i >= 0; i--) {
			System.out.print(i + " ");
		}

	}

}

0개의 댓글