Uri-Beecrowd problem no - 1146 solution in Java

112

import java.util.Scanner;
public class Main{
    public static void main (String[] args) {
        Scanner obj = new Scanner(System.in);
        int X;
        while(true){
            X = obj.nextInt();
            if(X == 0){
                break;
            }else{
                System.out.print("1");
                for(int i = 2; i <= X; i++){
                    System.out.print(" " + i);
                }
                System.out.println();
            }
        }
    }
}

Comments

Submit
0 Comments