Jose Vidal shared this file. Want to do more with it?
importjava.util.Scanner;
/**
*Lab1.java
*@authorJoseMVidal<jmvidal@gmail.com>
*Created on Jan30,2012
*
*/
publicclassLab1{
/**
*@param args
*/
publicstaticvoidmain(String[] args){
Scanner keyboard =newScanner(System.in);
System.out.print("Enter base width: ");
int width = keyboard.nextInt();
for(int row =0; row <= width /2; row++){
for(int col =0; col <= width; col++){
if(Math.abs((width /2)- col)<= row)
System.out.print("*");
else
System.out.print(" ");
}
System.out.println("");
}
}
}
We use cookies to provide, improve, protect and promote our services. Visit our Privacy Policy and Privacy Policy FAQs to learn more. You can manage your personal preferences, including your ‘Do not sell or share my personal data to third parties’ setting using the “Customize cookies” button below.