Guest User

Untitled

a guest
Feb 20th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  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. }
Add Comment
Please, Sign In to add comment