Advertisement
CR7CR7

Problem03

Sep 28th, 2022
947
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.47 KB | None | 0 0
  1. import java.util.Scanner;
  2. public class Problem03 {
  3.     public static void main(String[] args) {
  4.  
  5.         Scanner scan =new Scanner(System.in);
  6.         int n =Integer.parseInt(scan.nextLine());
  7.         StringBuilder result = new StringBuilder(" ");
  8.         for (int i = 1; i <n ; i++) {
  9.             result.append(i + " ");
  10.         }
  11.         for (int i =n;i>=1;i-=1){
  12.             result.append(i + " ");
  13.  
  14.  
  15.  
  16.         }
  17.         System.out.print(result);
  18.     }
  19.  
  20. }
  21.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement