Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package numberpyramid;
- import java.util.Scanner;
- public class NumberPyramid {
- public static void main(String[] args) {
- int row,i,j;
- Scanner sc = new Scanner (System.in);
- System.out.println("Enter number of rows:");
- row = sc.nextInt();
- for(i=1; i<=row; i++){
- for(j=1; j<=i; j++){
- System.out.print(j+" ");
- }
- System.out.print("\n");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment