sahadat49

Number Pyramid

Aug 4th, 2019
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. package numberpyramid;
  2. import java.util.Scanner;
  3. public class NumberPyramid {
  4.  
  5. public static void main(String[] args) {
  6. int row,i,j;
  7. Scanner sc = new Scanner (System.in);
  8. System.out.println("Enter number of rows:");
  9. row = sc.nextInt();
  10. for(i=1; i<=row; i++){
  11. for(j=1; j<=i; j++){
  12. System.out.print(j+" ");
  13. }
  14. System.out.print("\n");
  15. }
  16. }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment