try this code
<code>       

    String str = "" ;
            for (int i=1 ;  i<=5 ; i++){
                for (int j = 5; j >= i; j--)
                {
                    str = str + "  ";
                }
                for (int j=1 ; j<=i ; j++){
                    str = str+i.ToString();
                    str = str + "  ";
                }
                str = str + "\n";
            }
            label1.Text = str;

</code>    
-------------------------------------------------
i have tried this code using label in C# but u can do it on console by just printing resulting string on console.
hope this code will help.

Shahid Awan.


naheed_6 <[EMAIL PROTECTED]>
wrote:
Hi,

Can anyone help me with the following program. It says,

Write a program that prints a triangle in the form given below.

                                   1
                                2     2
                              3    3    3
                           4    4    4    4
                        5    5    5    5    5

The program I am making doesn't print an equilateral triangle like
this one. I'll be thankful if anyone can guide me in this regard.

Thank you






Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls. Great rates starting at 1¢/min.


YAHOO! GROUPS LINKS




Reply via email to