daily pastebin goal
47%
SHARE
TWEET

Untitled

a guest Feb 20th, 2018 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* Robert Torp
  2.  * 25.10.2011
  3.  * 11:28
  4.  */
  5.  
  6. import java.util.Scanner;
  7.  
  8. public class Torp_Robert_Oppgave3c {
  9.    
  10.     public static void main(String[] args) {
  11.    
  12.             /* Input til scanneren */
  13.         Scanner input = new Scanner(System.in);
  14.         System.out.print("Oppgi øvre grense: ");
  15.         int ovreGrense = input.nextInt();
  16.         int bredde = 1;
  17.    
  18.         for (int nvTall = 1; nvTall <= ovreGrense;) {
  19.            
  20.             for (int nvFelt = 1; nvFelt <= bredde; nvFelt++){
  21.                
  22.                 System.out.printf ("%" + bredde + "d", nvFelt);
  23.                 nvTall++;
  24.             }
  25.            
  26.             System.out.println();
  27.             bredde++;
  28.         }
  29.     }
  30. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top