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
What is the difference between "DataSet" and "DataReader"? The major differences between "DataSet" and "DataReader" are as follows:- 1)The "DataSet" is a disconnected archit

What is Operator Overloading in .NET? It gives a way to define and use operators like +, -, and / for user-defined classes or structs. It permits us to define/redefine the way

Develop Outlook Add-In for all versions I need simple code for Outlook(express,2003,2007,2010,2013) Add-In with functionality to repeatedly send CC to the specified email(s), th

Task on data mining Project Description: Task on Opinion Mining, Sentiment Analysis Skills required are C# Programming, Software Architecture, Data Mining

What is strong-typing versus weak-typing? Which is preferred? Why? Strong type is checking the types of variables as soon as possible, usually at compile time. While weak typing

What is a node? A network can have of two or more computers directly linked by some physical medium such as coaxial cable or optical fiber. Such a physical medium is known as L

Question: (a) List the two main advantages of developing a Multitiered Web Applications. (b) Explain how Validation controls are used to validate forms. (c) Using com

What is Dynamic Language Runtime (DLR)? DLR is a runtime environment that permits you to integrate dynamic languages with the Common Language Runtime (CLR) by adding a set of s

The Performance of the viewstate varies depending on the type of server control to which it is applied. The Text Box, Label,   RadioButton,CheckBox, and HyperLink are server contro

What are LINQ query expressions? A LINQ query, also known as a query expression, having of a combination of query clauses that identify the data sources for the query. It conta