Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class piramide {
- static Scanner reader= new Scanner(System.in);
- public static void main(String[]args){
- System.out.print("Input rows:");
- int x = reader.nextInt();
- for(int r=1; r<=x; r++){
- for(int s=(x-r); s>0; s--){
- System.out.print(".");}
- for(int c=1; c<=(2*r-1); c++){
- System.out.print("$");}
- for(int s=(x-r); s>0; s--){
- System.out.print(".");}
- System.out.println("");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement