Does anyone know how to solve the System.Formatexception problem ("incorrect character input)

Asked

Viewed 36 times

-1

Does anyone know what could be causing the Exception error in this code? (yes, I’m a beginner)

using System;
class Aula06 
{

    static void Main() 
    {



        double valorCompra = 5.50;
        double valorVenda;
        double lucro = 0.1;
        string produto = "Pastel Chinês";

        valorVenda = valorCompra + (valorCompra * lucro);


            Console.WriteLine("Produto......:{0,15}", produto);
            Console.WriteLine("Val.Compra....:[0,15:c}", valorCompra);
            Console.WriteLine("Lucro........:{0,15:p}", lucro);
            Console.WriteLine("Val.Venda........:{0,15:c}", valorVenda);
            Console.WriteLine("Final do Programa.");
            Console.ReadLine();
    }
}

1 answer

2

Good afternoon,

I believe you have using a [ by mistake right after the :, replace with { na line below:

Console.WriteLine("Val.Compra....:[0,15:c}", valorCompra);

Browser other questions tagged

You are not signed in. Login or sign up in order to post.