Printing triangles - c# program, DOT NET Programming

Printing Triangles - C# Program

I need program code for Printing Triangles in C#. Can anybody send me there ideas?

Posted Date: 2/12/2013 12:27:39 AM | Location : United States





Yes, i have an example regarding your problem you specified above. Try this it is beneficial for you.

 using System;  

class DollarDesign

{

  public static void Main()

 {

   int no=1,i,j;  

for(i = 1 ; i < 6 ; i ++) // Outer loop for incrememting the numbers to be displayed

  {

Console.WriteLine(" "); // Leave a line after each new number

for(j = 1; j < 6; j ++) // Inner loop to specify the numer of times the

particular number is to be printed.

   {

    Console.Write(no);

     if(i == j) 

      // If a number is printed that many number of times.

      // e.g. If 3 is there. The if 3 is printed 3 times, then this condition arises

    {

     no = no + 1; // Increment the number

      goto loop1; // Goto outer loop

    }

   }

  loop1:continue;

  }

  Console.ReadLine();

 }

}

Posted by samuel | Posted Date: 2/12/2013 12:28:19 AM

Thank you, for your expert advice. You have described very useful code. 

Posted by Amy | Posted Date: 2/12/2013 12:29:11 AM


Related Discussions:- Printing triangles - c# program, Assignment Help, Ask Question on Printing triangles - c# program, Get Answer, Expert's Help, Printing triangles - c# program Discussions

Write discussion on Printing triangles - c# program
Your posts are moderated
Related Questions
Reflection All .NET assemblies have metadata information stored  the types defined in the modules. And This metadata information can be accessed by mechanism called as "Reflect

What are the ways to implement locking in ADO.NET? There are many ways to implement locking using ADO.NET which are shown below:- 1)Whenever we call "Update" method of DataA

What is different overloading and overriding, please explain

Find out circumference and area of a circle - C# Program Need Help in Assignment.

Downloadable software for a PC computer and Mac Project Description: "The software" can be sold as a downloadable purchase. I must have all copy rights to "the software" when

Give a brief introduction of Windows Azure operating system. The Windows Azure operating system is used for running cloud services on the Windows Azure platform, as it includes

Question: (a) Outline four classes that allow you to work with File Streams. (b) (i) What potential problem can arise when you change items stored in an Application State

How many types of diagrams are there in UML? There are nine types of diagrams in the UML as shown below:- 1)Use case diagram: The use case diagram describe "WHAT" of a

Explain the new features in ADO.NET Entity Framework 4.0. ADO.NET Entity Framework 4.0 is introduced in .NET Framework 4.0 and contain the following new features: Persisten

How inheritance is achieved in VB.NET? The Inheritance is achieved by using "Inherits" keyword in the VB.NET (& For C# it is ":"). Easy Sample is provided in CD for understandi