import java.util.*;
public class Ch2Q35
{
public static void main(String[] args)
{int n, k = 1;
Scanner kbd = new Scanner(System.in);
System.out.print("Enter a integer: ");
n = kbd.nextInt();
loop: for(int i = 1; ; i++)
{for(int j = 1; j <= i; j++)
{System.out.printf("%-3d\t", k++);
if(k>n)break loop;
}
System.out.println();
}
}
}
No comments:
Post a Comment