Hi i wanna draw a pyramid that look like this
/
/
/
/______
in Microsoft visual studio c# language but it’s not working
i used this code in Microsoft visual studio
using System;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine(" / ");
Console.WriteLine(" / ");
Console.WriteLine(" / ");
Console.WriteLine("/______ ");
Console.ReadLine();
}
}
}
but it’s not working
please explain to me if possible why not working why your code is working in other words (what i need to know )
2
Answers
You need to escape backslashes, or use the
@
literal modifier. The backslash is used to do things like specifying a newline "n", so the compiler needs to be told explicitly when it write it out verbatimThis uses a multiline string literal
This is a full list of characters that require the escape sequence to ensure they are written verbatim
You should escape the backslashes, try this: