Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Project: Advanced_Loops - created by borkins on 2017-04-09.
- */
- import java.util.Scanner;
- public class _13_NumberPyramid
- {
- public static void main(String[] args)
- {
- Scanner console = new Scanner(System.in);
- int n = Integer.parseInt(console.nextLine());
- for (int row = 0, k = 1; k <= n; row++)
- {
- for (int col = 0; col < row && k < n; col++, k++) {
- System.out.print(k + " ");
- }
- System.out.println(k++);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment