class NUMBER_TRIANGLE
{
public static void main(String args[])throws IOException
{
InputStreamReader reader=new InputStreamReader(System.in);
BufferedReader input=new BufferedReader(reader);
System.out.println("ENTER THE NUMBER OF ROWS TILL WHERE TRIANGLE SHOULD CONTINUE");
int n=Integer.parseInt(input.readLine());
int r=1;
int t;
for(int i=0;i<n;i++)
{
t=n-1;
t=t-i;
for(String space=" ";t>0;t--)
{
System.out.print(space);
}
for(int j=1;j<=r;j++)
{
System.out.print(j);
}
r=r+2;
System.out.println();
}
}
}
2>Download SOURCE CODE
No comments:
Post a Comment