Guest User

Untitled

a guest
Feb 21st, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.59 KB | None | 0 0
  1. import java.util.*;
  2.  
  3. public class Trolooloo {
  4.  
  5.     public static void main(String[] args) {
  6.  
  7.         Scanner console = new Scanner(System.in);
  8.  
  9.         printNumbersIncreasing(console);
  10.  
  11.     }
  12.  
  13.     public static void printNumbersIncreasing(Scanner in){
  14.  
  15.         Scanner console = new Scanner(System.in);
  16.  
  17.         System.out.print("Oppgi øvre grense: ");
  18.         int limit = console.nextInt();
  19.         int n=1;
  20.         int rad=0;
  21.  
  22.         while(n<=limit){
  23.             for (int i = 1; i <= rad; i++) {
  24.                 if(n<=limit) {
  25.                     System.out.printf("%" + rad + "d", n);
  26.                 }
  27.  
  28.             n++;
  29.  
  30.             }
  31.             System.out.println("\n");
  32.             rad++;
  33.         }
  34.  
  35.     }
  36. }
Add Comment
Please, Sign In to add comment