Click here to Skip to main content
15,907,905 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
My code-
XML
int a = Convert.ToInt32(TextBox1.Text);
       for (int i = 1; i <= a; i++)
       {

           for (int j = a; j >= i; j--)
           {
              Response.Write("*");

           }
          Response.Write("<br />");
       }


But my out put triangle is 5 to 1 i want to triangle structur 1 to 5
Posted

1 solution

Hey it's simple thing
You are just doing a simple wrong thing in second loop
int a = Convert.ToInt32(TextBox1.Text);
       for (int i = 1; i <= a; i++)
       {
           for (int j = 1; j <=i; j++)
           {
               Response.Write(" * ");
           }
           Response.Write("<br>");
       }
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900