Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- public class Trolooloo {
- public static void main(String[] args) {
- Scanner console = new Scanner(System.in);
- printNumbersIncreasing(console);
- }
- public static void printNumbersIncreasing(Scanner in){
- Scanner console = new Scanner(System.in);
- System.out.print("Oppgi øvre grense: ");
- int limit = console.nextInt();
- int n=1;
- int rad=0;
- while(n<=limit){
- for (int i = 1; i <= rad; i++) {
- if(n<=limit) {
- System.out.printf("%" + rad + "d", n);
- }
- n++;
- }
- System.out.println("\n");
- rad++;
- }
- }
- }
Add Comment
Please, Sign In to add comment