0% found this document useful (0 votes)
15 views1 page

C# Triangle Pattern Program

Uploaded by

yushk1022
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views1 page

C# Triangle Pattern Program

Uploaded by

yushk1022
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Program 5: Triangle Pattern

Explanation:
This program prints a triangle of a given width using the entered number.

C# Code:
using System;

class Program
{
static void Main()
{
[Link]("Enter a number: ");
int number = 6; // Test Data

[Link]("Enter the desired width: ");


int width = 6; // Test Data

for (int i = 1; i <= width; i++)


{
for (int j = 1; j <= i; j++)
{
[Link](number + " ");
}
[Link]();
}
}
}

Expected Output:
6
6 6
6 6 6
6 6 6 6
6 6 6 6 6
6 6 6 6 6 6

You might also like