0
 using System;

 namespace ConsoleApplication1
{
    class Program
   {
        static void Main(string[] args)
    {
        int x1, x2, a, b,c,sum;
        double delta;
        Console.WriteLine("dati coeficientii ecuatiei de gradul doi ax^2+bx+c");
        a = Convert.ToInt32(Console.ReadLine());  //same with int.parse(Console.ReadLine());
        b = Convert.ToInt32(Console.ReadLine());
        c = Convert.ToInt32(Console.ReadLine());
         sum=(b*b)+(-4)*(a*c);
         Console.WriteLine("{0}",sum);
         //delta = (-b + Math.Sqrt(sum))/(2*a);
        // Console.WriteLine("{0}",delta);
         Console.ReadKey();
      }
    }
}

Im trying to set a negative value to my local variable sum, but it only reads the unsigned number. it looks like it takes the negative value as something that is not a compatible value.

Please suggest.

bllakjakk
  • 5,045
  • 1
  • 18
  • 28

0 Answers0