Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Robert Torp
- * 25.10.2011
- * 11:28
- */
- import java.util.Scanner;
- public class Torp_Robert_Oppgave3c {
- public static void main(String[] args) {
- /* Input til scanneren */
- Scanner input = new Scanner(System.in);
- System.out.print("Oppgi øvre grense: ");
- int ovreGrense = input.nextInt();
- int bredde = 1;
- for (int nvTall = 1; nvTall <= ovreGrense;) {
- for (int nvFelt = 1; nvFelt <= bredde; nvFelt++){
- System.out.printf ("%" + bredde + "d", nvFelt);
- nvTall++;
- }
- System.out.println();
- bredde++;
- }
- }
- }
Add Comment
Please, Sign In to add comment