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