Computer Science, asked by dd0166900, 3 months ago

Create a pattern as shown in the sample output. By using forward-slash, back-slash and pipe.

Get the number of rows and number of symbols from the user.

one symbol is /\ (forward-slash and back-slash)

In-between rows add pipe '|' at the start and at the end.

Sample 1

Attachments:

Answers

Answered by kunaljain649
7

Answer:

          Console.Write("Number of Rows : ");

          int n = Convert.ToInt32(Console.ReadLine());

          Console.Write("Number of Symbols : ");

          int s = Convert.ToInt32(Console.ReadLine());

          int space = s*2-2;

         

          for(int i=0;i<n*2-1;i++){

              if(i%2==0){

              for(int j=0;j<s;j++)

               Console.Write("/\\");

              }

              else{

                  Console.Write("|");

                  for(int j=0;j<space;j++)

                    Console.Write(" ");

               Console.Write("|");

              }

             Console.Write("\n");

          }

Similar questions