[ pyramid.java ]
class pyramid
{
public static void main(String args[])
{
int no=Integer.parseInt(args[0]),i=0,j=0,s=0;
String ch=args[1];
for(i=0;i<no;i++)
{
for(s=i;s<no;s++)
{
System.out.print(" ");
}
for(j=0;j<i;j++)
{
System.out.print(" " + ch );
}
System.out.println("");
}
}
}
GoTo Command Prompt(Win + R)
ReplyDeleteHOW TO COMPILE
javac c:\yourdir\pyramid.java
HOW TO EXECUTE
java c:\yourdir\pyramid