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
Develop a Windows Backup Application Application Goal The goal is to prepare an easy to use application that provides the user peace of mind that all of their firewalls are b

Demonstrating Boxing and Unboxing - C# Program Hi, Can any of you, tell me how to use boxing and Unboxing in c#?

What are the steps involved to fill a dataset ? The sample code is shown below: Private Sub LoadData() Dim strConnectionString As String strConnectionString = AppSetti

Project Description: Legacy ASP.NET application for managing tasks for a private client needs a complete re-write. The application has approximately 2500 lines of code, combi

ASP.NET/MSSQL/ MVC completing backend solution + integrating with frontend. Project Description: System is used for tracking company's activities through several projects by

What is an Object in Dot Net? This is the basic unit of a system. An object is an entity that has identity, attributes, and behavior. The Objects are members of a class. The cl

I need C# Programmer Project Description: To help in the production of a C# module to provide a web service. We are based in Littlehampton, West Sussex. Skills required ar


What is a Cloud Service? A cloud service is used to build cloud applications. This service gives the facility of using the cloud application without installing it on the comput

Differentiate between managed and unmanaged code? Managed code is the code that is implemented directly by the CLR instead of the operating system. The code compiler first comp