Computer Science, asked by pundiraryan57, 5 months ago

Write a
C
Program
to Print
1
22
333
4444
333
22
1​

Answers

Answered by rishabh994
1

Answer:

class Program

{

static void Main(string[] args)

{

// input value for printing the pattern.

int num=5;

//below for loop is printing the pattern from 1 to num value

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

{

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

{

Console.Write(i);

if(i==k)

{

Console.Write("\n");

}

}

}

//below for loop is printing the pattern from num-1 to 1 value

for (int i = num - 1; i >= 1; i--)

{

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

{

Console.Write(i);

if (i == k)

{

Console.Write("\n");

}

}

}

}

}

Similar questions