Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class piramidbroj {
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- Scanner input = new Scanner (System.in);
- int n=input.nextInt();
- for(int i=1;i<=n;i++)
- {
- for(int p=1;p<=i;p++)
- System.out.print(p);
- System.out.println();
- }
- System.out.println(); System.out.println();
- for(int i=1;i<=n;i++)
- {
- for(int k=n-i;k>0;k--)
- System.out.print(" ");
- for(int p=1;p<=i;p++)
- System.out.print(p);
- System.out.println();
- }
- System.out.println();System.out.println();
- for(int i=1;i<=n;i++)
- {
- for(int k=n-i;k>0;k--)
- System.out.print(" ");
- for(int p=1;p<=i;p++)
- System.out.print(p);
- for(int p=i-1;p>=1;p--)
- System.out.print(p);
- System.out.println();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement